You are on page 1of 9

What you learn Built-in Functions

Link Topic Covered What you Learn

VBAExcel VBA versus Excel Worksheet ▪ Using VBA Date Function


Functions - some examples ▪ Lower Case, Upper Case and Proper Case
▪ Difference between VBA & Excel functions
▪ Using Max worksheet function

VBAFunctions Working with VBA Functions


▪ VBA Month & MonthName functions
▪ VBA ISEMPTY function (similar to ISBLANK in Excel)
▪ VBA TYPENAME function
MsgBox Display Message Box with MsgBox
Function ▪ Quick & simple message box with MsgBox function
▪ MsgBox that asks for user feedback
InputBox_VBA Create an Input Box: InputBox VBA
Function ▪ Quick & simple input box with InputBox function
▪ Use Input box to add data to the last row of the database
InputBox_Excel Create an Input Box: Excel InputBox
Method ▪ Excel Input Box method for more flexibility (e.g. data
validation)
▪ Use Input box to allow user to select ranges
Activity Activity: Create an Input Box and a With an input box, the user will select a range of numbers and
Message Box with message box they find out which are the top 3 values in
the range selected.
VBA versus Excel Worksheet Functions - some examples

Get Date here:

Change the below to their specified case:


uPPer caSe
loweR casE
proPer caSE
proper case

Get Max of below data set :

52 20 70
33 40 10
65 59 65
15 62 12
24 41 72
35 96 39
75 46 92
59 38 16
Working with VBA Functions

Current month:
Current month name:
Month abbrev. of this number: 3

Are these cells empty?

Empty?
Display Message Box with MsgBox Function
1. Create a welcome message for the user.
2. Clear values in A7:B9 - but before clearing double-check with the user.

52 20
33 40
65 59
Create an Input Box: InputBox VBA Function
Create an InputBox to add a
Subtitle

Customer Name
Tanox
Wencal
Create an InputBox to add
the customer name to the
next empty cell.
Create an Input Box: Excel InputBox Method

Amount
Customer Name Invoiced Add the customer name and
Tanox 200 amount to the next available
Wencal 300 row (use InputBox Method
for the amount)

Let the user highlight a range. Once


they press ok, let them know how
many blank cells and non-blank
cells are in the selected range.
mer name and
next available
Box Method
t)

hlight a range. Once


et them know how
s and non-blank
selected range.
Activity: Create an Input Box and a Message Box
The aim of the exercise is as follows: Example of input box
1. Create an input box which allows the user to highlight a range of numbers.
2. After the user clicks ok, they will get a message box.
3. The message box shows them the top 3 numbers, in the format shown.
4. Assign the macro to the button.

Bid Amount
6335
6173
7203
7070
8046
7218 The answer is in the completed workbook in module "ProjectActivity"
7741
6042
6381
8489
7820
6951
7702
8916
7615
7793
8477
7899
6503
7254
8651
7018
7186
7006
7183
8076
of input box Example of message box

You might also like