1 Get the developer tab
2 Open the Visual Basic Editor Alt + F11
1.1
3 Insert a module in VBA project ( for writing code)
4 change the font typr, colour and text.
Writing basic code
1 Start a subroutine beginning with "Sub"
2 write code systematically by providig space up and to the right
3 Wite commnets beginning with '
1.2
4 Enter an object( the thing to manipulate) Ctl+ Space
5 Wite a method or a property
6 To seprate a object from a method/property. Enter "."
Saving the code
1 Save the code before running it as no changes can be made after thwe code has been run
1.3
2 Save the file not in .xlsx(macro free woorkbook) but in .xlsm( macro enalbled workbook) format
3 Once you open the file again, Enable content taskbar will ask if the Macros has to be added to the woork
1.4 1 Running the code, either in macros or excel workbook using F5
2 Make sure you click on the sub you want to run
1.5 syntax Errors: Structure or punctuation error
Complier Errors: Improper function
Runtime Error
1.2.1 1 Step through the code by going line wise by pressing the F8 key
2 Put The excel sheet and VBA side by side in same window
1.2.2 1 Set a break point at any line by clicking on the left side or using F9
2 Break points not saved on closing the file
1.3.1 1 Adding Buttons to the worksheet to r run the Subroutine directly
2 Developet- Insert - Form Controls - Buttons
e has been run
ed workbook) format
has to be added to the woorkbook or not. Once Enabled the macros are added and will not be asked again.