HI All,
I really appreciate the help on this forum!
I am a huge noob and have modified some vba code to copy data (varying rows all the time) from multiple sheets to a master sheet. I intend to run the code on "Activate".
Unfortunately, I am getting error even before I get to the copy code, the error is on defining the array of sheets which contain the data to be copied.
Private Sub Worksheet_Activate()
Dim ws As Worksheet, LR As Long, LT As Long, Lrow As Long, CopyRange As Range
Application.ScreenUpdating = False
'Sheet2.Unprotect Password:="password"
Me.UsedRange.Offset(8).Clear 'clears existing report
For Each ws In Sheets(Array("1 - Site", "2 - Building Exterior", "3 - Building Interior", _
"4 - Structural", "5 - Mechanical", "6 - Electrical"))
LR = ws.Range("B" & Rows.Count).End(xlUp).Row
ws.Range("A3:C" & LR).Copy
Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
ws.Range("I3:J" & LR).Copy
Range("E" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
ws.Range("K3" & LR).Copy
Range("D" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
ws.Range("L3" & LR).Copy
Range("G" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
Does anyone see whats going on here? "For each sheet" is highlighted on debug.
For clarification, I am trying to get the array sheets to copy column data to the master for the following columns:
A2->A9
B2->B9
C2->C9
I3->E9
J3->F9
K2->D9
L2->G9
Anyone can lend a hand?
Bookmarks