Search This Blog

Monday, January 9, 2012

Macros Programming in Excel Sheet 2010


Macros Programming in Excel Sheet 2010
1)    Start Excel Sheet 2010
2)    Click on View tab




3)    Now click on dropdown Macros and select Record Macros in dropdown menu



4)    Press ok in the new window opened



5)    Now again pull down dropdown menu of Macros and click on Stop Recording
 
6)    Now select View Macros in dropdown menu of Macros.

7)    You will get a window showing all the macros like this

8)    Select your Macro as in our case its Macro1 and now click on edit.
9)    You will get a new window as shown in figure below
This window is the visual basic programming interface
This Interface show different components as project explorer, property window, code window.
Out of all this most important for our sake is code window highlighted in red color.


10)                      It shows a macro “Macro1” underlined in red color. It’s the macro that we have recorded in step 4.
11)                      Now delete everything except
Sub Macro1
End Sub

12)                      Now put your code in between these two lines

13)                      Press Alt+F11 to go back to the excel sheet
(You can always switch between programming interface and excel sheet with Alt+F11)
14)                      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.