Monday, April 22, 2013

Excel VBA Tutorial - Writing Your First Macro

For Excel users to maximize their performance, especially Excel's power users, they need to understand how to utilize Excel's built in VBA or Visual Basic for Applications.

It's very easy to get hooked once you've created a report or a macro that saves you countless time!

In this post, we'll make a simple macro to make the Cell A1 to have the value of 100 in it. It's very easy.

Follow these easy steps:

1. Get the Developer tab. In Excel 2010 and 2007, just go to Excel Options from the File or Orb and click the checkbox for Developer in the Ribbon options.

2. Hold Alt and press F11 to get in the Visual Basic Editor.

3. In the text area type the following:

Sub MyFirstMacro()

Range("a1") = 100

End Sub


That's it! You wrote your first macro!!!

Ok the Breakdown. . .

When you type Sub and hit spacebar and type a name for your macro, Excel knows you're making a new procedure (aka macro).

Everything in between that and the "End Sub" is your code. Then, we simply told it that cell A1 needs to be 100.

TO RUN YOUR NEW MACRO:
Just hit Alt+F8 and select your new macro, called MyFirstMacro, and double click or hit 'Run'.

Check out My Youtube Excel VBA Course - FREE.
www.youtube.com/user/ExcelVbaIsFun


4 comments:

  1. It was a very good post indeed. I thoroughly enjoyed reading it in my lunch time. Will surely come and visit this blog more often. Thanks for sharing.
    excel vba courses london

    ReplyDelete
  2. Everything you an imagine is real. Have a good day! Keep on sharing knowledgeable ideas :)
    imarksweb.net

    ReplyDelete
  3. Thanks for sharing a such a knowledgable post with us. Excelllent knowledge deleiverd to us.

    vba course in delhi
    vba course in Gurgaon
    vba course in Noida

    ReplyDelete