Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jeff
 
Posts: n/a
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Andrew Taylor
 
Posts: n/a
Default 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.


  #3   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE-submitting of: constructing (complex) variables with worksheet functions broer konijn Excel Worksheet Functions 0 June 13th 06 11:36 AM
Bubble Charts with two non-numerical variables andy62 Excel Worksheet Functions 2 May 22nd 06 01:08 AM
constructing (complex) variables with worksheet functions broer konijn Excel Discussion (Misc queries) 0 May 16th 06 10:55 PM
VBA reseting variables bpeltzer Excel Discussion (Misc queries) 0 February 4th 06 04:52 PM
Passing Variables Jeff Excel Discussion (Misc queries) 1 November 4th 05 07:46 PM


All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"