Thread: error message
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default error message

hi
a range is an object.
a string is a value.
i am confused now!?!?!?!
if a string then......
dim db as string
db = currentdb.value
else
dim db as range
set db = range("currentdb")

a string is somthing like "i am a string"
a range is someting like A1:R20

are we on the same page?!?!?!?

regards
FSt1

"ranswrt" wrote:

I have

dim db as string

I am trying to get the string from the cell named 'currentdb'. I have used
this same code in other procedures and it has worked fine.
"FSt1" wrote:

hi
try
set db = Range("currentdb")

you set objects and a range is an object. values are just equals(=)

regards
FSt1

"ranswrt" wrote:

I have the following code:

db = Range("currentdb")

I have used this code before in other procedures and it has worked. When I
use in a userform_Terminate I get the error

method 'Range' of Object'_Global' failed.

'currentdb' is a named cell on a worksheet.

Why won't this work?
Thanks