Macros Programming in Excel Sheet 2010

Macros programming in Excel has made Excel very easy to use; it provides a Visual Basic programming interface which is easy to use. Here are step-by-step instructions of how to do it.

  1. Start Excel Sheet 2010
  2. Click on the View tab
  3. Now click on the dropdown Macros and select Record Macros in the dropdown menu:

    Macro1.jpg
     
  4. Name your Macro; in the sample I named it "MyMacro". You can also set a shortcut key for it e.g. I have used "Ctrl+W". Now press "OK" in the new window:

    Macro2.jpg
     
  5. Now again pull down the dropdown menu of Macros and click on Stop Recording.
  6. Now select View Macros in the dropdown menu of Macros.
  7. You will get a window showing all the macros like this:

    Macro3.jpg
     
  8. Select your Macro; in our case it's My Macro and now click on edit.
  9. You will get a new window as shown in the following figure; this window is the Visual Basic programming interface. The interface shows various components such as the Project Explorer, the Property Window and the Code Window.

    You will see:

    Sub MyMacro
    End Sub

    Place your code between those two lines:

    Macro4.jpg
     
  10. Press Alt+F11 to go back to the Excel sheet (you can always switch between the programming interface and an Excel sheet with Alt+F11).
  11. Now again select View Macros from the Macros drop down menu and just click on run, after selecting your macro from the View Macro window to see the effect of your work. In this sample we have written the code to change the text to UPPERCASE; you can code it according to your requirement.

    Macro5.jpg

Enjoy programming Macros for Excel.


Similar Articles