Description
VBA comes with many built-in functions for receiving user input, handling mathematical calculations, string manipulation, dates and time, and more. Learn about them here.
Notes
More VBA functions can be found here.
To test against tolerance values, it is common to use the Abs() function on the remainder of two Double values, and then compare that result to the tolerance. For example:
Dim dblVal1 as Double
Dim dblVal2 as Double
Dim dblTolerance as double
Sub main()
dblVal1 = 48.39
dblVal2 = 48.41
dblTolerance = 0.01
If Abs(dblVal1 - dblVal2) > dblTolerance Then MsgBox "Tolerance exceeded"
End Sub
Lesson Files
Lesson 1.6 – data conversion functions
Lesson 1.6 – date and time functions
Lesson 1.6 – InputBox function
Lesson 1.6 – MsgBox function
Lesson 1.6 – replace function
Lesson 1.6 – split function
Lesson 1.6 – string functions
Homework
Lesson 1.6 homework part A solution
Lesson 1.6 homework part B solution
Lesson 1.6 homework part C solution