Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Setting CONST referencing a cell Value

I've been trying to enter

CONST celladdress as STRING = sheets("mysetup").Range("E13").value

' E13 on my sheet mysetup contains the value "G1" (without the
quotes)

I'can't seem to accomplish this. Am I doing something wrong?

TIA,

Jim

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Setting CONST referencing a cell Value

Hi Jim,

You can only assign a constant value to a Constant.

You could use:
Const sStr As String = "A"

But you cannot use:
Const sStr2 As String = Range("A1").Value
'or
Const sStr As String = Chr(65)

Try instead:

Dim cellAddress As String

cellAddress = Sheets("mysetup").Range("E13").Value


---
Regards,
Norman


"JMay" wrote in message ...
I've been trying to enter

CONST celladdress as STRING = sheets("mysetup").Range("E13").value

' E13 on my sheet mysetup contains the value "G1" (without the quotes)

I'can't seem to accomplish this. Am I doing something wrong?

TIA,

Jim



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 468
Default Setting CONST referencing a cell Value

Thanks Norman;

Seems like a small price to pay by using:

Dim cellAddress As String
cellAddress = Sheets("mysetup").Range("E13").Value

Thanks,

Jim May

"Norman Jones" wrote:

Hi Jim,

You can only assign a constant value to a Constant.

You could use:
Const sStr As String = "A"

But you cannot use:
Const sStr2 As String = Range("A1").Value
'or
Const sStr As String = Chr(65)

Try instead:

Dim cellAddress As String

cellAddress = Sheets("mysetup").Range("E13").Value


---
Regards,
Norman


"JMay" wrote in message ...
I've been trying to enter

CONST celladdress as STRING = sheets("mysetup").Range("E13").value

' E13 on my sheet mysetup contains the value "G1" (without the quotes)

I'can't seem to accomplish this. Am I doing something wrong?

TIA,

Jim




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
public const availability? lcoreyl[_22_] Excel Programming 5 July 1st 06 04:22 PM
relative path for const in vba code [email protected] Excel Programming 5 March 1st 06 04:29 PM
Not recognizing a Const Dan T[_3_] Excel Programming 7 July 18th 04 12:45 AM
Public Const on a Drive MD Excel Programming 1 July 15th 04 03:53 PM
crash changing const to public const BrianB Excel Programming 0 August 4th 03 10:13 AM


All times are GMT +1. The time now is 06:30 AM.

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"