Learning Visual Basic in Excel

I’m trying to figure out how to use Visual Basic in Excel on a Mac. So far I’ve figured out that:

  1. Go to Tools > Macro > Visual Basic Editor (sometimes you need to click on a cell or the top left column cell with the “A” for it to light up).
  2. Turn on “Options Explicit” by going to Preferences > Editor and turn on “Require variable declaration” option.
  3. Add a module by going to Insert > Module (in the Visual Basic Editor pane), and you should have a window that reads “Options Explicit” at the top.
  4. Then name a subroutine and enter your code:

    Screen Shot 2018-11-28 at 9.51.18 AM

  5. Go back to Excel and run the named Macro (and for some reason select a column for the Macro menu to pop up).

    excel.gif

Phew, that was painful, but definitely satisfying! —JM