Reputation: 133
I have a sheet in which formulas are stored now I want that formulas to be copied and paste in all the other worksheets that I have in my workbook
I have such 70 sheets in which data need to be copied.
sheet name from which data will be copied is "SAMPLE" data should be copied from sheet number 3 ("SAMPLE" is sheet number 1 and after leaving 2 sheets, data need to be copy in each sheet in range of "Y1:BA151"
I have tried following code
Sub COPY()
Dim WS_Count As Integer
Dim I As Integer
WS_Count = ActiveWorkbook.Worksheets.Count
For I = 1 To 70
Worksheets("SAMPLE").Range("Y1:BA151").COPY
Next I
End Sub
but I am begginer so i am lacking somewhere, kindly help with this. in advance thx.
Upvotes: 1
Views: 50
Reputation: 50162
You need to loop from 3
to the Count
of the Worksheets
, and then use i
within the loop. Or maybe that should be 4
, not sure if I am reading " 'SAMPLE' is sheet number 1 and after leaving 2 sheets" correctly.
Sub Copy
ThisWorkbook.Worksheets("SAMPLE").Range("Y1:BA151").Copy
Dim i as Long
For i = 3 to ThisWorkbook.Worksheets.Count
ThisWorkbook.Worksheets(i).Range("Y1").PasteSpecial xlPasteAll
Next
Application.CutCopyMode = False
End Sub
Upvotes: 2