I'm fairly new to VBA and would like to seek some advice.
I'm running a macro to compile tables into a row-by-row transaction list.
However, I do not want to replicate this code 11 times for the different month columns.
How can I perform a loop so it automatically performs the task across all 12 months?
Code below and table conversion as per attached picture.
Thanks!
'For Apr'20 - 'Copy name and category to clipboard
Sheets("Sheet2").Range("A3:C15").Copy
'Select last row of reference cell
lastRow = Sheets("Consolidated Cost Sheet_Working").Cells(Rows.Count, "A").End(xlUp).Row + 1
Range("A" & lastRow).Select
'Paste clipboard as values
ActiveCell.PasteSpecial xlPasteValues
'Copy period and drag down
Sheets("Sheet2").Range("D2").Copy
lastRow = Sheets("Consolidated Cost Sheet_Working").Cells(Rows.Count, "D").End(xlUp).Row + 1
Range("D" & lastRow).Select
ActiveCell.PasteSpecial xlPasteValues
Sheets("Consolidated Cost Sheet_Working").Range("C3").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Select
Range(Selection, Selection.End(xlUp)).Select
Application.CutCopyMode = False
Selection.FillDown
'Copy Financial Info to Sheet
Sheets("Sheet2").Range("D3:D15").Copy
lastRow = Sheets("Consolidated Cost Sheet_Working").Cells(Rows.Count, "E").End(xlUp).Row + 1
Range("E" & lastRow).Select
ActiveCell.PasteSpecial xlPasteValuesAndNumberFormats