hi all, I've created VBA for my monthly reporting below.
i would like to seek help if anyone could help to simplify the VBA code below.
i have 2 workbooks (master & report). Master is running pivot query everyday from other sources and report will be using below VBA code to captured the data from master.
thanks
i would like to seek help if anyone could help to simplify the VBA code below.
i have 2 workbooks (master & report). Master is running pivot query everyday from other sources and report will be using below VBA code to captured the data from master.
thanks
VBA Code:
Sub COPY_EXAMPLE()
Dim master As Workbook
Dim report As Workbook
Set master = Workbooks("Daily Report 2024.xlxm")
se report = Workbooks("Reporting 2024.xlsx")
Application.DisplayAlerts = False
'summary sheet
master.Worksheets("summary").Range("D17:O29").Copy
report.Activate
report.workshets("2024").Range("C15:N27").PasteSpecial Paste:=xlPasteValues
master.Worksheets("summary").Range("D39:O51").Copy
report.Activate
report.workshets("2024").Range("C34:N46").PasteSpecial Paste:=xlPasteValues
'Jan 24
master.Worksheets("JAN24").Range("B5:AH17").Copy
report.Activate
report.Worksheets("JAN").Range("D5:AH17").PasteSpecial Paste:=xlPasteValues
master.Worksheets("JAN24").Range("C24:028").Copy
report.Activate
report.Worksheets("JAN").Range("W24:AI28").PasteSpecial Paste:=xlPasteValues
'Feb 24
master.Worksheets("FEB24").Range("B5:AH17").Copy
report.Activate
report.Worksheets("FEB").Range("D5:AH17").PasteSpecial Paste:=xlPasteValues
master.Worksheets("FEB24").Range("C24:028").Copy
report.Activate
report.Worksheets("FEB").Range("W24:AI28").PasteSpecial Paste:=xlPasteValues
'Mar 24
master.Worksheets("MAR24").Range("B5:AH17").Copy
report.Activate
report.Worksheets("MAR").Range("D5:AH17").PasteSpecial Paste:=xlPasteValues
master.Worksheets("MAR24").Range("C24:028").Copy
report.Activate
report.Worksheets("MAR").Range("W24:AI28").PasteSpecial Paste:=xlPasteValues
'Apr 24
master.Worksheets("APR24").Range("B5:AH17").Copy
report.Activate
report.Worksheets("APR").Range("D5:AH17").PasteSpecial Paste:=xlPasteValues
master.Worksheets("APR24").Range("C24:028").Copy
report.Activate
report.Worksheets("APR").Range("W24:AI28").PasteSpecial Paste:=xlPasteValues
Application.DisplayAlerts = True
End Sub