-3

如果有人可以帮助我使用 VBA,我将不胜感激。循环遍历同一 WorkBook 中的多个工作表并复制 1 列,即 col B,然后粘贴/附加到活动工作表的下一个空白列中。

谢谢,阿迪尔

4

2 回答 2

1

这里有一些限制,但这应该可以帮助您入门。

Sub copyColumn()
    Dim wks As Worksheet
    Set wks = ActiveSheet

    'Source worksheet to copy from
    Dim srcwk As Worksheet
    Set scrwk = ActiveWorkbook.Worksheets(3)

    'Copy range A1:A10 from source to active sheet in next open column
    scrwk.Range("A1:A10").Copy wks.Range("IV1").End(xlToLeft).Offset(0, 1)
End Sub
于 2013-10-14T21:38:15.870 回答
0

像这样的东西?

Sub Move_Column()

CurrWS = ActiveSheet.Name
    For each Sheet in ActiveWorkbook.Sheets
        If Sheet.Name <> CurrWS Then
            NextColumn = Sheets(CurrWS).Range("XFD1").End(xlToLeft).Column + 1
            Sheets(CurrWS).Range(Sheets(CurrWS).Cells(1, NextColumn), Sheets(CurrWS).Cells(100, NextColumn)).Value = Sheet.Range(Sheet.Cells(1, 2), Sheet.Cells(100, 2)).Value
        End if
    Next

End Sub
于 2013-10-14T21:57:42.193 回答