The difference between VBA functions and statements

Office supports Visual Basic for Applications (VBA), a development language. Some users never need VBA, but most of us at least dabble with it a bit. VBA offers a number of built-in functions and knowing which one to use can be a chore for anyone new to development. Fortunately, there's good help available:

  1. In the Visual Basic Editor (VBE), choose Microsoft Visual Basic from the Help menu.
  2. In the resulting Help task pane, click the Microsoft Visual Basic Documentation link to display a list of subjects.
  3. Click the Functions or Statements link to display a graduated alpha listing.

Being familiar with the available functions—and there are many—is vital to working efficiently with VBA. Now, you might be wondering whether you need a function or a statement. While we often use the terms interchangeably, they really aren't. Statements have been around since the beginning. Never versions have replaced statements with VBA functions. For that reason, always use a function if possible. They have the most up-to-date functionality. There may be a similar statement, but don't use it. Office supports them only for backward compatibility. They could disappear from a future version, without notice.


Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Editor's Picks