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


Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons 50+ Hours of Instruction 200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

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...
Tutorial Details
Downloadable Files: Excel File
Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course