Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default error message

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default error message

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default error message

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default error message

Check your spelling of that range name.

And check to make sure that the sheet being looked at actually has a range named
currentdb.



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


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default error message

hi dave,
thanks for your input.
but did i miss someting about objects and values
please correct me if i'm wrong.

regards
FSt1

"Dave Peterson" wrote:

Check your spelling of that range name.

And check to make sure that the sheet being looked at actually has a range named
currentdb.



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


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default error message

The OP added this detail:
dim db as string
in the followup post.

So that means that:
db = Range("currentdb")
is relying on the default property of the range (.value).



FSt1 wrote:

hi dave,
thanks for your input.
but did i miss someting about objects and values
please correct me if i'm wrong.

regards
FSt1

"Dave Peterson" wrote:

Check your spelling of that range name.

And check to make sure that the sheet being looked at actually has a range named
currentdb.



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


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default error message

hi
i was unaware of a default value property. i thought that this had to be
specified.
after testing, you're rignt
thanks for correcting me. i learned something.
disregards all of my posts.

regards
FSt1

"Dave Peterson" wrote:

The OP added this detail:
dim db as string
in the followup post.

So that means that:
db = Range("currentdb")
is relying on the default property of the range (.value).



FSt1 wrote:

hi dave,
thanks for your input.
but did i miss someting about objects and values
please correct me if i'm wrong.

regards
FSt1

"Dave Peterson" wrote:

Check your spelling of that range name.

And check to make sure that the sheet being looked at actually has a range named
currentdb.



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

--

Dave Peterson


--

Dave Peterson

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default error message

I think it's a good idea to specify the property that you want. I like it
because it makes the code much more self-documenting.

FSt1 wrote:

hi
i was unaware of a default value property. i thought that this had to be
specified.
after testing, you're rignt
thanks for correcting me. i learned something.
disregards all of my posts.

regards
FSt1

"Dave Peterson" wrote:

The OP added this detail:
dim db as string
in the followup post.

So that means that:
db = Range("currentdb")
is relying on the default property of the range (.value).



FSt1 wrote:

hi dave,
thanks for your input.
but did i miss someting about objects and values
please correct me if i'm wrong.

regards
FSt1

"Dave Peterson" wrote:

Check your spelling of that range name.

And check to make sure that the sheet being looked at actually has a range named
currentdb.



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

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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
e-mail - error message Run-time error 429 CAM Excel Programming 1 July 15th 08 10:44 AM
replace VBA run-time error message with custom message BEEJAY Excel Programming 13 July 14th 06 03:59 PM
error message: compile error, argument not optional Pierre via OfficeKB.com Excel Programming 3 September 5th 05 03:45 PM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 05:30 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


All times are GMT +1. The time now is 08:49 PM.

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"