尝试创建宏或找到一个解决方案,以便能够将列K中所有行的内容分别附加到列S中所有行的末尾。创建新列对我没有帮助。
我需要能够将列K中的数据附加到列S(每个月)。任何帮助表示赞赏。这两列都在同一张纸上。
答案 0 :(得分:0)
试试这个子:
Sub AppendColumns()
Dim sheetname As String, srccell as String, dstcell as String
Dim src As Range, dst As Range
Dim y As Integer
sheetname = "Sheet1" 'Put your sheet´s name here, as listed in VBA file list
srccell = "K1" 'Put your source top cell here
dstcell = "S1" 'Put your destination top cell here
Set src = Worksheets(sheetname).Range(srccell)
Set dst = Worksheets(sheetname).Range(dstcell)
y = 0
Do Until src.Offset(y, 0) = ""
dst.Offset(y, 0) = dst.Offset(y, 0) & src.Offset(y, 0)
y = y + 1
Loop
End Sub