Using a Varible inside of a proper address

  • Thread starter Thread starter jeffreyoung
  • Start date Start date
J

jeffreyoung

Top of the morning

Assume the following:
LogSheet being a definied string variable
LogSheet has the value of 'Feb' assinged to it

It is used in the following line of code

ActiveWorkbook.Names.Add Name:="count",
RefersToR1C1:="=LogSheet!R8C7"

The code runs

I want Feb!r8c7.....I get LogSheetr8c7

Thanks in advance for any help
 
Try this
ActiveWorkbook.Names.Add Name:="count",
RefersToR1C1:="=" & LogSheet & "!R8C7"

If this does not work you may have to sent the string to a variable first
x= "=" & LogSheet & "!R8C7"
then
ActiveWorkbook.Names.Add Name:="count",
RefersToR1C1:= x

TerryK
 
Back
Top