Get the Numeric Value of any Constant in VBA

Add to Favorites
Author: | Edits: don

Two simple tricks to get the number value for constants in VBA and Macros for Excel.

Constants in VBA are like variables whose values never change and it is important to be able to get the constant value of a constant without wasting time looking it up or searching for it.

This is especially helpful when you use the macro recorder to generate some code and compare it to your own macros because one version might use the numeric value of the constant and one version might use the name of the constant, and you want to make sure that you can quickly compare the two versions without issue.

Additional Resources

Constants in VBA (msft)

List of Constants in Excel VBA (msft)


Downloadable Files: Excel File

Question? Ask it in our Excel Forum


Our Excel Courses

  • Skill Level: All Levels
  • |
  • 5 hours+

How to make a fully featured professional form in Excel that is unbreakable. This includes how to use the form to store, view, edit, and delete data from a data storage worksheet.

  • Skill Level: All Levels
  • |
  • 2 hours

Send Emails from Excel using VBA and Macros. This course starts from the Basics and builds up to more advanced examples with attaching workbooks, worksheets, PDF's, automatically sending emails, including a signature, error handling, increasing speed, and more.

Similar Content on TeachExcel
Formula to Get the Last Value from a List in Excel
Tutorial: Formulas that you can use to get the value of the last non-empty cell in a range in Excel...
PV Function - Get the Present Value in Excel
Tutorial: The Present Value (PV) function in Excel will return the current value of an investment.┬...
Capitalize the First Letter of Every Word in a Cell
Macro: This macro will make the text of any selected cell in excel proper case. This means that t...
Get the Decimal Part of a Number in Excel
Tutorial: How to get the decimal part of a number without any rounding in Excel. This tip allows yo...
PMT Function - Get the Payment Due for a Loan in Excel
Tutorial: How to calculate the payment amount for a loan or similar financial instrument that has a ...
SMALL Function - Get the Lowest Values from a List in Excel
Tutorial: Return the smallest values from a list, or any of the smallest values, in Excel. This inc...