Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Note: This article has done its job, and will be retiring soon. To prevent "Page not found" woes, we're removing links we know about. If you've created links to this page, please remove them, and together we'll keep the web connected.

The easiest way to start programming with VBA in Office for Mac 2011 is to use the Macro Recorder. The recorder simply records a task that you perform in your Office app, and then converts it into VBA code. Later, you can look at the code that was generated to learn what VBA code is used to complete that action.

You may be wondering, why do I need to learn the code, if the recorder can do the work for me? As you use the Macro Recorder to create macros, you may find that there are limits to what you’re able to record, and you’ll need to go into the code to create more complex capabilities in your macro.

Let’s look at an example of how to record the task of deleting a row from a table in Word.

  1. First create a table in Word.

    Create Table

  2. Place your cursor in the first cell of the table. In the example above, we’ll place the cursor on the cell Andrew.

  3. Click Tools > Macro > Record New Macro

  4. Change the macro name to DeleteRow, and click OK.

Tip: The macro name can’t contain spaces or special characters.

  Record Macro

  1. Now with the recorder started, select the Table Layouttab, and click Delete > Delete Rows.

    Delete Row

  2. Stop the Macro Recorder by clicking Tools > Macro > Stop Recording.

    Now that you’ve recorded your action, let’s take a look at the code

    Note: The Macro Recorder does not record keystroke.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×