VBA Do循环更改变量

时间:2017-06-29 09:30:55

标签: excel vba loops do-loops

我有一个代码可以将数据列从一个工作表复制到另一个工作表。我想集成一个do循环,这样我就不必为每一列重复相同的命令。

Dim LastRow As Long

Sheets("PWR 2 DATA CAPTURE SHEET Shared").Select
With ActiveSheet
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
'MsgBox LastRow

Dim x As Integer


Sheets("PWR 2 DATA CAPTURE SHEET Shared").Select
Dim Copyrange1 As String
Startrow = 3
Let Copyrange1 = "B" & Startrow & ":" & "B" & LastRow
Range(Copyrange1).Select
Selection.Copy
Sheets("PWR2 data capture sheet ").Select
Range("B3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False 

我想要'1'后复制范围更改为'20','B'更改为C,D,E,F,G,H,I,......直到'AA'对应于列优秀。

任何帮助将不胜感激。谢谢

0 个答案:

没有答案