Excel VBA Macros
In this chapter let us understand how to write a simple macro. Let us take it step by step.Step 1. First let us enable 'Developer' menu in Excel 20XX. To do the same, click on File >> Options.
Step 2. Click Customize Ribbon Tab and check 'Developer' and click 'OK'.
Step 3. The 'Developer' ribbon appears in menu bar.
Step 4. click 'Visual Basic' Button to open VBA Editor.
Step 5. Now Let us start scripting by adding a button. Click 'Insert' >> Select 'button'.
Step 6. Perform a Right Click and choose 'properties'.
Step 7. Edit the name and Caption as shown below.
Step 8. Now Double click the button, the sub procedure outline would be displayed as shown below.
Step 9. Let us start coding by simply adding a message.
Private Sub say_helloworld_Click() MsgBox "Hi" End SubStep 10. Now you can click the button to execute the sub-procedure. The Output of the sub-procedure is shown below. We will demostrate further chapters using a simple button as explained from step#1 to 10. Hence It is important to understand this chapter thoroughly.
by http://www.tutorialspoint.com
Post a Comment