Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Public Const to refer to a range name
Can this be done??
I'm trying to set this up and I'm having trouble. Keep getting a compile error: Constant expression required. ________________________________________ Option Explicit Public Const CDLoc = Range("CDFLoc").Value |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Public Const to refer to a range name
Hi Tim,
TimT wrote: Can this be done?? I'm trying to set this up and I'm having trouble. Keep getting a compile error: Constant expression required. ________________________________________ Option Explicit Public Const CDLoc = Range("CDFLoc").Value No - a constant truly has to be static or constant. You could either use a public variable or a public function that returns what you're looking for: Public Function gsGetCDLoc() As String gsGetCDLoc = Range("CDFLoc").Value End Function But at that point, you may as well write out the Range and the .Value everywhere. I would suggest using a public constant for "CDFLoc" however - that way, if your range name ever changes, you only have one place to change it in your code. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
public const availability? | Excel Programming | |||
Declaring a Public variable as a Range and its lifetime | Excel Programming | |||
Public Const on a Drive | Excel Programming | |||
Public Function IsStrikeThrough(rng As Range) | Excel Programming | |||
crash changing const to public const | Excel Programming |