我尝试使用差异放置格式sheet I want to copy将一些数据从某张纸复制到另一张纸 sheet I want to paste 我已经创建了一些代码,这似乎可行,但是当我添加循环代码时,它只会复制一次(仅复制我在输入框中输入的最后一个数字) 这是我的代码
Sub Finale5IWish()
Dim iRow As Integer
Dim iRoq As Integer
Dim iRaw As Integer
Dim iRaq As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim i As Integer
iRow = InputBox("Which row?")' just type "2" for example
iRoq = InputBox("Which cell?")' just type "2"for example
iRaw = InputBox("Which row?")' just type "2" for example
iRaq = InputBox("Which cell?")' just type "2" for example
i = 1
z = InputBox("how many luv do yu want?") 'Its a Input Box for how much you will run the code
x = 1 * (z - 1)
y = 5 * (z - 1)
Do While i < z
Worksheets("Sheet2").Cells(iRow + x, iRoq).Value = Worksheets("Sheet3").Cells(iRaw + y, iRaq).Value
Worksheets("Sheet2").Cells(iRow + x, iRoq + 1).Value = Worksheets("Sheet3").Cells(iRaw + 1 + y, iRaq).Value
Worksheets("Sheet2").Cells(iRow + x, iRoq + 2).Value = Worksheets("Sheet3").Cells(iRaw + 2 + y, iRaq).Value
Worksheets("Sheet2").Cells(iRow + x, iRoq + 3).Value = Worksheets("Sheet3").Cells(iRaw + 3 + y, iRaq).Value
Worksheets("Sheet2").Cells(iRow + x, iRoq + 4).Value = Worksheets("Sheet3").Cells(iRaw + y, iRaq + 2).Value
Worksheets("Sheet2").Cells(iRow + x, iRoq + 5).Value = Worksheets("Sheet3").Cells(iRaw + 1 + y, iRaq + 2).Value
Worksheets("Sheet2").Cells(iRow + x, iRoq + 6).Value = Worksheets("Sheet3").Cells(iRaw + 2 + y, iRaq + 2).Value
Worksheets("Sheet2").Cells(iRow + x, iRoq + 7).Value = Worksheets("Sheet3").Cells(iRaw + 2 + y, iRaq + 1).Value
i = i + 1
Loop
End Sub
希望你们中的一些人可以帮助指出我的错误,或者只是简单地编写代码。 对不起,我的英语不好^。^