Excel macro n00b
I just got tired and lazy while formating a report in Excel. Instead of manually clean the same rows more than 1100 times, I thought I’d better use my time creating a macro to automate the process…
All I wanted to do was to cut and paste a cell, and delete 3 rows, then repeat:
Move the cell to the right of the name (cut and paste it 2 rows above and one column right):
Delete empty rows (rows 3, 4 and 5 in the example above), and repeat this 1100 times:
So this is my extremely basic macro for doing this:
- Sub Move_action()
- ' Move_action Macro
- ' Keyboard Shortcut: Ctrl+Shift+A
- Do While InStr(ActiveCell.Value, "Action") > 0
- ActiveCell.Cut Destination:=ActiveCell.Offset(-2, 1)
- ActiveSheet.Range(ActiveCell.Offset(-1, 0).EntireRow, ActiveCell.Offset(1, 0).EntireRow).Delete
- ActiveCell.Offset(1, 0).Select
- Loop
- End Sub
I then just selected the first “Action” cell, and ran the macro, watching Excel (slowly) do the work for me while I was eating my lunch 🙂
Categories: Tech tips