您好我需要复制特定范围的单元格并遍历行并继续复制过程,直到遇到空值。很难得到代码 请帮忙
答案 0 :(得分:0)
试试这个
Dim rng As Range, cell As Range
Set rng = Range("A1:B4")
' loop trought each row in selected column Columns(1) = first column in range
For Each onlyDefinedColumnRow In rng.Columns(1).Rows
If IsEmpty(onlyDefinedColumnRow) Then Exit For
i = i + 1
Next onlyDefinedColumnRow
' or loop trought each cell in range
'For Each cell In rng.Rows
' If IsEmpty(cell) Then Exit For
'i = i + 1
'Next cell
rng.Resize(i).Copy Destination:=Cells(i + 2, 1)