If you are wanting to just copy the whole column, you can simplify the code a lot by doing something like this:
(如果您只想复制整个列,则可以通过执行以下操作来简化代码:)
Sub CopyCol()
Sheets("Sheet1").Columns(1).Copy
Sheets("Sheet2").Columns(2).PasteSpecial xlPasteValues
End Sub
Or
(要么)
Sub CopyCol()
Sheets("Sheet1").Columns("A").Copy
Sheets("Sheet2").Columns("B").PasteSpecial xlPasteValues
End Sub
Or if you want to keep the loop
(或者如果您想保持循环)
Public Sub CopyrangeA()
Dim firstrowDB As Long, lastrow As Long
Dim arr1, arr2, i As Integer
firstrowDB = 1
arr1 = Array("BJ", "BK")
arr2 = Array("A", "B")
For i = LBound(arr1) To UBound(arr1)
Sheets("Sheet1").Columns(arr1(i)).Copy
Sheets("Sheet2").Columns(arr2(i)).PasteSpecial xlPasteValues
Next
Application.CutCopyMode = False
End Sub
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…