By John Walkenbach

Ready to do some Excel 2016 VBA programming? Hopefully, you are because here comes the hands-on part. Just follow these instructions carefully and you’ll be well on your way:

  1. Select a cell.

    Any cell will do.

  2. Choose Developer  →  Code  →  Record Macro or click the macro recording button on the status bar.

    The Record Macro dialog box appears.

    The Record Macro dialog box appears when you’re about to record a macro.

    The Record Macro dialog box appears when you’re about to record a macro.
  3. Enter a name for the macro.

    Excel provides a default name (something like Macro1), but it’s better to use a more descriptive name. NameAndTime (with no spaces) is a good name for this macro.

  4. Click the Shortcut Key box, and enter Shift+N (for an uppercase N) as the shortcut key.

    Specifying a shortcut key is optional. If you do specify one, you can execute the macro by pressing a key combination — in this case, Ctrl+Shift+N.

  5. Make sure the Store Macro In setting is This Workbook.

  6. You can enter some text in the Description box, if you like.

    This step is optional. Some people like to describe what the macro does (or is supposed to do).

  7. Click OK.

    The Record Macro dialog box closes, and Excel’s macro recorder is turned on. From this point, Excel monitors everything you do and converts it to VBA code.

  8. Type your name in the active cell.

  9. Move the cell pointer to the cell below and enter this formula:

    =NOW()

    The formula displays the current date and time.

  10. Select the formula cell, and press Ctrl+C to copy that cell to the Clipboard.

  11. Choose Home  →  Clipboard  →  Paste  →  Values (V).

    This command converts the formula to its value.

  12. With the date cell selected, press Shift+up arrow to select that cell and the one above it (which contains your name).

  13. Use the controls in the Home  →  Font group to change the formatting to Bold and make the font size 16 point.

  14. Choose Developer  →  Code  →  Stop Recording.

    The macro recorder is turned off.

Congratulations! You just created your first Excel VBA macro. You may want to phone your mother and tell her the good news.