Using a Varible inside of a proper address

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top