Name references and VBA

J

JRocket02

Hi all,

Second time I posted this, but could not find my first post anywhere! Sorry
if the other post made it to somewhere I can't find.

Is there any way to make VBA automatically recognize the name of a cell and
use it as a variable? So, for example, I name my cell "clientFirstName". I
would like to use this as a variable in VBA w/o needing to have "Dim
clientFirstName as String". Even if it just defines all the cell names as
Variants would be fine. Or is dimensioning a variable the same name as the
name reference the best way to do it?

I have a lot of static variables, and keeping everything in synch is 4 times
harder when everything has to be defined twice, especially for maintenance.
Any ideas? Thanks.
 
F

Frank Kabel

Hi
try
dim rng as range
set rng = range("clientFirstName")
msgbox rng.value
 
Top