hey all
i have the following macro, however I am struggling to make it work on my file:
i have attached my sample. essentially i have the dec, jan etc month tabs to consolidate into the summary sheet. i would like the data to be dumped from both sheets into the summary sheets. i will be adding a feb, march, april etc tabs as the year progresses.
i would also like column A in the summary sheet to repeat the name of the sheet the data is being retrieved from.
pls help..not sure what the issue with the macro above is :S
i have the following macro, however I am struggling to make it work on my file:
Code:
Private Sub Worksheet_Activate()
Dim Sh As Worksheet
Dim Newsh As Worksheet
Dim LR As Long, NR As Long
Application.ScreenUpdating = False
Set Newsh = ThisWorkbook.Sheets(Sheet1.Name)
Newsh.Range("A1").CurrentRegion.Offset(1).Clear
NR = 9
For Each Sh In ThisWorkbook.Worksheets
If Sh.Name Like "*" And Sh.Name <> Sheet1.Name And Sh.Visible Then
LR = Sh.Range("B" & Sh.Rows.Count).End(xlUp).Row
If LR > 8 Then
Sh.Range("A2:U" & LR).Copy
Newsh.Range("C" & NR).PasteSpecial xlPasteValues
Newsh.Range("C" & NR).PasteSpecial xlPasteAll
LR = Newsh.Range("C" & Rows.Count).End(xlUp).Row
Newsh.Range("B" & NR, "B" & LR) = Sh.Name
NR = LR + 1
End If
End If
Next Sh
If NR > 9 Then
Range("A2:A" & NR - 1).Formula = "=row(A1)"
End If
With Newsh.Range("A1").CurrentRegion.Font
.Name = "Arial"
.Size = 8
End With
Application.ScreenUpdating = True
End Sub
i would also like column A in the summary sheet to repeat the name of the sheet the data is being retrieved from.
pls help..not sure what the issue with the macro above is :S