- The macro recorder can’t record complex actions.
- Macro recorder can’t generate code that performs looping, conditional statement, and so on.
Recording Macro
- Open a new blank workbook.
- On any worksheet, select cells from A3 to C3.
- Click Tools –> Macro -> Record New Macro...
- In the Record Macro dialog box, type “SubMergeCells” in Macro name textbox to set the macro name. Then click Ok.
- In the formatting toolbars, click Merge and Center button. This action will merge cells from A3 to C3.
- To stop recording macro, click the Stop button.
Run the recorded macro
- On any worksheet, select cells from D4 to G4.
- Click Tools -> Macro -> Macros... or press Alt+F8.
- In the Macro dailog box, select “SubMergeCells”. Click the Run botton to run the macro.
- Cells D4 to G4 now have been merged.
No comments:
Post a Comment