ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Having a problem using a variable in (https://www.excelbanter.com/excel-programming/315202-having-problem-using-variable.html)

Kobayashi[_48_]

Having a problem using a variable in
 

I've *******ized the following from a recorded macro but it won't wor
with the variable name 'davvsheet', but it works fine if I specif
workbooks(".....") etc.?

With OSSheet
.Columns("L:L").Select

DAbook.Names.Add Name:="Lookuplist2", RefersToR1C1:= _
"=davvsheet!c1"

Any help would, as always, be much appreciated.

Regards,

Adria

--
Kobayash
-----------------------------------------------------------------------
Kobayashi's Profile: http://www.excelforum.com/member.php...info&userid=87
View this thread: http://www.excelforum.com/showthread.php?threadid=27358


JulieD

Having a problem using a variable in
 
Hi

by placing "davvsheet" in the quotes you've made it a literal string try
RefersToR1C1:= "=" & davvsheet & "!c1"

Cheers
JulieD

"Kobayashi" wrote in message
...

I've *******ized the following from a recorded macro but it won't work
with the variable name 'davvsheet', but it works fine if I specify
workbooks(".....") etc.?

With OSSheet
Columns("L:L").Select

DAbook.Names.Add Name:="Lookuplist2", RefersToR1C1:= _
"=davvsheet!c1"

Any help would, as always, be much appreciated.

Regards,

Adrian


--
Kobayashi
------------------------------------------------------------------------
Kobayashi's Profile:
http://www.excelforum.com/member.php...nfo&userid=871
View this thread: http://www.excelforum.com/showthread...hreadid=273587





All times are GMT +1. The time now is 10:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com