By using listi.net you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

listi.net

 


Hello World!

The VB Editor is where you will enter a VBA Code.

You can either:
  • Record a Macro
  • Import code as a module
  • Search for code, copy and paste in
  • type your code.

    There are typically 4 Windows you will use
  • Code Window
  • Immediate Window
  • Project Explorer
  • Properties Window

    Let's write some VBA Code!

    Editor
    1. Open a new Excel WorkBook aka an Excel file
    2. Press Alt F11 or Developer > Visual Basic to go to the Editor
    3. Editor has an old style Windows menu and not a ribbon at the top
    4. Below that are a toolbox of icons
    5. Leftmost one will switch you to Excel
    6. View > Code opens a Coding windows where you can enter your VBA or Macro statements
    7. There are two drop-down or combo-boxes at the top. The right one is the Procedure drop-down and the left one is the Object drop-down

    8. Set the following options
      • Tools > Options

    9. Enter your first program
      Click the code window start typing type following:

      Sub HelloWorld()
         msgbox "Hello world"
      End sub


    10. Press the Play button or F5 to run the code.
    11. The Hello World Message box displays


  • blog comments powered by Disqus