我已使用Mrig's code将多行中的范围插入到第二张工作表的单个列中,但不能在那里提出补充问题:-(
有没有办法在每个插入范围之间添加空行?
谢谢!
我的Mrig代码版本是:
Sub RangetoColumn()
Dim LastRow As Long, LastColumn As Long
Dim CurrentSheet As Worksheet, TargetSheet As Worksheet
Dim i As Long, j As Long, Count As Long
Set CurrentSheet = ThisWorkbook.Worksheets("sheet1")
Set TargetSheet = ThisWorkbook.Worksheets("sheet2")
LastRow = CurrentSheet.Cells(Rows.Count, "A").End(xlUp).Row
Count = 1
For i = 1 + 1 To LastRow
LastColumn = CurrentSheet.Cells(i, Columns.Count).End(xlToLeft).Column
For j = 5 To j + 1
TargetSheet.Range("A" & Count).Value = CurrentSheet.Cells(i, j).Value
Count = Count + 1
Next j
Next i
End Sub
答案 0 :(得分:0)
未经测试,但
TargetSheet.Range("A" & (Count*2)).Value = CurrentSheet.Cells(i, j).Value
应该这样做。
答案 1 :(得分:0)
谢谢你们!
Count = count + 1
在下一个j之后,在插入的行范围之后插入一行,而Range("A" & (Count*2))
在每行之后插入一行,因此Count = count + 1
可以满足我的需要。