My data looks like this:
a 1 2 b 1 2 c 1 2
I want to reorganise it so it looks like this:
a 1 a 2 b 1 b 2 c 1 c 2
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Please note that this is typed from memory, and NOT tested (I do not have access to Excel currently); you might need to THINK and adapt!
Recording a Macro:
From now on, the shortcut key repeats the same actions for the line the cursor is on.
Alt+F8 shows a list of the available macros, where you can select to edit the macro you created above.
If you EDIT a cell WHILE recording the macro you will get a statement in the macro that reads similar to:
... this is easily changed into
if ActiveCell.value<>"" then goto Repeat
which of course belongs at the end of the macro code, just before "end sub".
Then add a line
at the top, as a marker for where to restart for repeats
(that is a "label", look it up in the help for "goto" if I goofed here).
If you have done the above correctly, the macro will repeat for all lines that has something in the cell where it "ends"