Visual Basic for Applications is a programming language that allows you to expand upon macros in Microsoft Office products. It is not the same as Visual Basic, as it needs an application to run and cannot run programs independently.
There are many uses for VBA, but it’s a good idea to start small when you’re learning something new. This piece of code will run a macro which will count the number of rows and columns in a selection of an Excel worksheet and put the result in a message box. You would enter this code in the Visual Basic for Applications Editor.
Sub Count()
myCountR = Selection.Rows.Count
myCountC = Selection.Columns.Count
MsgBox “You selected ” & myCountR & ” rows and ” & myCountC & ” columns.”
End Sub
This sample of code gives the macro a name (Count), creates 2 variables (myCountC and myCountR) and provides a message box to pop up on the screen.
If you would like to learn more, we have a 2 day class that will help you learn the terminology and the basics of VBA programming. Visit our website to find out when the next class is offered!





