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 |
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] |
All times are GMT +1. The time now is 02:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com