Today I put together some code for a VB macro, but, having tried different methods I can't get it to loop. The closest I could come was getting my 1st copy paste to do so infinitely. I'm trying to get it to copy the department name in front of every entry for that department, delete the subtotal Rows and the copy the next department name etc.
Range("A5").Select If ActiveCell <> "" Then ActiveCell.Select Selection.Copy 'If the cell has a Department, copy it' ActiveCell.Offset(1, 0).Select If ActiveCell = "" Then ActiveSheet.Paste 'paste the department numbers on the rows without it.' ElseIf ActiveCell Like "Totals*" Then Rows(ActiveCell.Row).delete 'delete the Company Totals Rows' ActiveCell.Select End If End Sub