gpt4 book ai didi

excel - 如何将一张工作表中的一列复制到另一张工作表中的另一列,同时跳过空白单元格?

转载 作者:行者123 更新时间:2023-12-04 20:47:46 25 4
gpt4 key购买 nike

我有一张纸,其中有一列从 C2 到 C6115。在该范围内有许多空单元格。我只想在 excel 2007 中使用 VB 将填充的单元格复制到单独的工作表中。谁能给我一个可以帮助我执行此操作的通用代码?

最佳答案

Sub copy()
Dim i As Long
Dim cell As Range
i = 1
For Each cell In Sheets(1).Range("c2:c6115")
If Not IsEmpty(cell) Then
Sheets(2).Range("c" & i).Value = cell.Value
i = i + 1
End If
Next cell
End Sub

关于excel - 如何将一张工作表中的一列复制到另一张工作表中的另一列,同时跳过空白单元格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6233009/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com