Enable Developer Tab:
- Click at File → Options
- Select Customize Ribbon → Customize the Ribbon → Main Tabs → Tick Developer
- Click OK
- Click at Developer tab
- Click Insert
- Select Command Button (ActiveX Control)
- Drag to any cells. Adjust the size to make it bigger
- Then right click
- Select View Code
- A new screen will appear. This is VBA Editor
- Place your cursor between Private Sub CommandButton1_Click() and End Sub
- Type: Range("A1").Value="Hi, Welcome!"
- Close the VBA Editor screen to go back to Excel
- Go to Developer and switch off Design Mode by clicking at Design Mode
- Then click at Command Button
- You will see the result in cell A1
- Congratulations! You have successfully created your first VBA
- Go to Developer tab, click at Visual Basic to open VBA Editor OR
- Right click at any worksheet, select View Code
No comments:
Post a Comment