Final Exam Study Guide (VBA)
How to declare a constant?
/const/name as/Data type= value
Object Hierarchy
1) A cell ("A1") 2) A range of cells (A1:A5) 3) Worksheet (Sheet 1) 4) Workbook (workbooks "Budget.xlsx") 5 Workbooks ("Budget.xlsx").sheet1.Range("C2:C5")
How to declare a Variable
1) Reserve a memory space 2) Define variable name 3) Define the data type of the variable
How to write a Procedure?
1) Sub name of procedure 2) Variables 3) Codes 4) End Sub
Different data types:
1) Text 2) Whole Number 3) Decimal 4) True/False
Input Box
=InputBox("Prompt","Title","Default")
How to extract substring from a string?
=Left (String,length) =Left (Names, 3)
What is VBA?
A collection of objects that we are manipulating.
Module
A collection of procedures
Variables
A memory space to store data.
Constraint
A value that can't be changed while running the program.
True/False ->
Boolean
Sub Procedure
Completes a set of tests
Casting
Converting the data from one type to another.
What is the keyword to declare a variable?
Dim
How Dim works
Dim VARIABLE NAME as DATA TYPE
MessageBox
Displays results to users
Decimal ->
Double
Proporties
Format of the object Ex: Range ("A1").font.size=18
Type 0
Formula
InputBox
Gets data from the users
What does the extraction "Mid" allow you to do?
Give one the ability to extract from wherever they want. Ex: =mid(string,start,length) =mid(names,3,3)
Whole Number ->
Integer
How to get input from the user?
Make a input box
VbNewLine
Moves one line to another
Type 1
Numbers
What does the = sign refer to in VBA?
Refers to assignment NOT equal to.
Function Procedure
Returnes a value
Text ->
String
The ______ cannot have spaces and cannot start with a number.
Sub Name of Procedure
Example of a sub
Sub Password Dim Lname As String Dim MofBirth As String Dim SSN As String Dim upassword As String Lname= InputBox ("Enter Your Last Name") End Sub
Type 2
Text
Methods
The actions that can be performed on the object. Ex: Range C2:C5".clearcontents
Default
The default format for users to follow
Title
The title of the input box
What does VBA stand for?
Visual Basics for Application
Prompt
the text to display to the user