Hi
Sorry if i've posted this in the wrong forum but I couldn't find one specific to excel.
I have a workbook with several sheets called "Instructions", "Summary", "Template" and then several other sheets labelled "Company1", "Company2", "Company3", etc.
I keep getting a Runtime 1004 Select method of Worksheet class failed error on the line in the script highlighted below.
To explain the purpose, the script should clear all content except row A in the Summary tab. Then it should copy A109 to CH109 from each tab (except the first 3) in turn into the first blank row in the summary tab. Depending on the group, there could be any number of company tabs.
Once it's done all the tabs, it should end
Application.ScreenUpdating = False
myCount = Sheets.Count
Sheets("Summary").Select
Range("A2:CH2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
ActiveSheet.Next.Select
s = ActiveSheet.Name
For i = 4 To myCount
Sheets(s).Select
ActiveSheet.Next.Select 'FAILS HERE
s = ActiveSheet.Name
Range("A109:CH109").Select
Selection.Copy
Sheets("Summary").Select
Range("A65536").Select
Selection.End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
Next i
Application.ScreenUpdating = True
End Sub
I've been trying several help options and looking for similar forum posts but all errors of the same code seem to point at generic 'select' errors
Any help would be greatly appreciated
Sorry if i've posted this in the wrong forum but I couldn't find one specific to excel.
I have a workbook with several sheets called "Instructions", "Summary", "Template" and then several other sheets labelled "Company1", "Company2", "Company3", etc.
I keep getting a Runtime 1004 Select method of Worksheet class failed error on the line in the script highlighted below.
To explain the purpose, the script should clear all content except row A in the Summary tab. Then it should copy A109 to CH109 from each tab (except the first 3) in turn into the first blank row in the summary tab. Depending on the group, there could be any number of company tabs.
Once it's done all the tabs, it should end
Application.ScreenUpdating = False
myCount = Sheets.Count
Sheets("Summary").Select
Range("A2:CH2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
ActiveSheet.Next.Select
s = ActiveSheet.Name
For i = 4 To myCount
Sheets(s).Select
ActiveSheet.Next.Select 'FAILS HERE
s = ActiveSheet.Name
Range("A109:CH109").Select
Selection.Copy
Sheets("Summary").Select
Range("A65536").Select
Selection.End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
Next i
Application.ScreenUpdating = True
End Sub
I've been trying several help options and looking for similar forum posts but all errors of the same code seem to point at generic 'select' errors
Any help would be greatly appreciated