![]() |
How to efficiently declare variables
I guess I don't understand how to correctly declare variables. Before I had
been writing Dim x1, x2, x3, x4 as double I just learned that this declares x1, x2, and x3 as variants and x4 as a double. Is there an easier way to declare x1, x2, x3 and x4 as double other then typing x1 as double, x2 as double, etc. This seems like a HUGE pain because I have about 75 variables in my module. (These are declared at the modular level, so they can be used by all the macros in the module) Thanks for your help. |
How to efficiently declare variables
You could maybe use DefDbl :
DefDbl X This means that any variable whose name begins with an X (or x) is automatically a double, unless it's declared otherwise. See Excel Help for more details.. Andrew Jeff wrote: I guess I don't understand how to correctly declare variables. Before I had been writing Dim x1, x2, x3, x4 as double I just learned that this declares x1, x2, and x3 as variants and x4 as a double. Is there an easier way to declare x1, x2, x3 and x4 as double other then typing x1 as double, x2 as double, etc. This seems like a HUGE pain because I have about 75 variables in my module. (These are declared at the modular level, so they can be used by all the macros in the module) Thanks for your help. |
How to efficiently declare variables
Nope, that is what you are stuck with.
But honestly, how big a pain is it? As soon as you type D intelliesense gives you a list of values, o a shorter list, and u, Double is at the top. 75 variables is nothing, I have hundreds of constants I declare as Public Const COL_NAME As Long = 17 etc. but I only do it once. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Jeff" wrote in message ... I guess I don't understand how to correctly declare variables. Before I had been writing Dim x1, x2, x3, x4 as double I just learned that this declares x1, x2, and x3 as variants and x4 as a double. Is there an easier way to declare x1, x2, x3 and x4 as double other then typing x1 as double, x2 as double, etc. This seems like a HUGE pain because I have about 75 variables in my module. (These are declared at the modular level, so they can be used by all the macros in the module) Thanks for your help. |
All times are GMT +1. The time now is 02:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com