Skip to content
Resources (to be done in order)
- File > Info > Customize Ribbon > Check Developer Tab > Alt + F11 to open VBA Editor
- Know what Modules, Functions, Sub-Procedures are
- ‘ or REM to include comments in program
- Ctrl + G to open Immediate Window. Use “Debug.Print” to print data into the immediate window.
- Variables: String, Integer and others
- Arithmetic Operators: + (add), – (subtract), * (multiply), / (divide)
- Comparison Operators: = (equal), <> (not equal), > (greater than), < (less than), >= (greater than equal to), <= (less than equal to)
- Concatenation Operators: If A = 10, B = 5: A+B=15, A&B=105
- If Condition
- if (condition) then
- Elseif (condition)
- End If
- For Loop
- Define worksheet as “ws”. ws.cells(row,column) = value to assign a value to a particular cell
- Proper Indentation for Codes
- function findArea (Length as Double, Length as Double)
- end function
- Write a simple program to print “Hello World” in the immediate window.
- Store 2 numbers from 0 to 100 in 2 different variables. Print the addition, subtraction, multiplication and division results of these 2 numbers.
- Store 2 numbers from 0 to 100 in 2 different variables. If No. 1 is greater than No. 2 print “No.1 > No.2”. If No. 2 is greater than No. 1 print “No. 2 > No. 1”. Else print “No. 1 = No. 2”
- Print numbers 1 to 50 using a For Loop.
- Print numbers 1 to 50 using a While Loop
- *Print numbers 1 to 50 using any loop in a continuous string (e.g. 1, 2, 3, 4, 5, 6…) (Hint use a string variable to store)
- Print results from Qn 2 in first 4 cells of the excel sheet
- Print results from Qn 3 in 1 cell on the excel sheet
- Print results from Qn 4 in the first 50 rows of the excel sheet.
- Print results from Qn 4 in the first 50 columns of the excel sheet.
- Print the resulting string from Qn 6 in the first cell of the excel sheet.
- *Write a function to convert kilometres into miles. (Refer to VBA Functions tutorial)