在 Excel 2013 中複製並貼上

在 Excel 2013 中複製並貼上

如何將工作表 2 的儲存格 H47 複製到工作表 500,然後將其貼到工作表 1,其中 A2 代表工作表 2 H47; Sheet3 H47 為 A3; A4 為 Sheet4 H47; A5 適用於 Sheet5 H47...A500 適用於 Sheet500 H47

答案1

如果我理解你的問題,在 VBA 中,你可以這樣做:

Sub CopyToManySheets
Dim copyRng as Range
Set copyRng = Range ("Sheet2!$H$47")
copyRng.select
Selection.copy
Dim index as integer
For index = 1 to 500
If Not (IsError (Range ("Sheet" & index & "!A" & index))) Then
Range ("Sheet" & index & "!A" & index).Select
Selection.Paste
Else
End if
Next
Set copyRng = Nothing
Exit Sub

相關內容