以下是我的代码:
Sub Pitchers()
For i = 1 To 30
Worksheets("Starting Pitchers Salary").Range("B" & (1 + i)).Copy
Worksheets("Pitcher Matchup Analysis").Paste
Destination = Worksheets("Pitcher Matchup Analysis").Range("B3")
For j = 1 To 9
Worksheets("Pitcher Matchup Analysis").Range("A" & (32 + j)).Copy
Worksheets("Batter Matchup Analysis").Range("B1").PasteSpecial xlPasteValues
Worksheets("Batter Matchup Analysis").Range("B88:AC88").Copy
Worksheets("Pitcher Matchup Analysis").Range("C" & (32 + j) & ":AD" & (32 + j)).PasteSpecial xlPasteValues
Next j
Worksheets("Pitcher Matchup Analysis").Range("A65:S65").Copy
Worksheets("Pitcher Comparison").Range("A" & (1 + i) & ":S" & (1 + i)).PasteSpecial xlPasteValues
Next i
End Sub
以下所有内容均正常工作
Worksheets("Starting Pitchers Salary").Range("B" & (1 + i)).Copy
当它循环时,它不会向下移动一个单元格。在第一个循环中,它复制单元格B2(应该如此),但在后续循环中,它应该复制单元格B3,B4等,但每次都执行B2。这里有什么建议吗?
答案 0 :(得分:0)
Worksheets("Pitcher Matchup Analysis").Paste
Destination = Worksheets("Pitcher Matchup Analysis").Range("B3")
将上述内容改为:
Worksheets("Pitcher Matchup Analysis").Paste _
Destination := Worksheets("Pitcher Matchup Analysis").Range("B3")