ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unclear Error Message (https://www.excelbanter.com/excel-programming/328449-unclear-error-message.html)

Yossi[_2_]

Unclear Error Message
 
Hi,
I am trying to set a range variable with a defined range, but I get this
error all the time:
"Run-time error '1004':
Application-defined or object-definned error."

the code is this:
Sub temp()
Dim MyRange As Range

Set MyRange = Names("temp").RefersToRange
..
..
..
End Sub

I can't figure it out. Can you help?

Tom Ogilvy

Unclear Error Message
 
Sub temp()
Dim MyRange As Range

Set MyRange = ThisWorkbook.Names("temp").RefersToRange
..
..
..
End Sub

is a possibility.

--
Regards,
Tom Ogilvy


"Yossi" wrote in message
...
Hi,
I am trying to set a range variable with a defined range, but I get this
error all the time:
"Run-time error '1004':
Application-defined or object-definned error."

the code is this:
Sub temp()
Dim MyRange As Range

Set MyRange = Names("temp").RefersToRange
.
.
.
End Sub

I can't figure it out. Can you help?




Yossi[_2_]

Unclear Error Message
 
thanks!

"Tom Ogilvy" wrote:

Sub temp()
Dim MyRange As Range

Set MyRange = ThisWorkbook.Names("temp").RefersToRange
..
..
..
End Sub

is a possibility.

--
Regards,
Tom Ogilvy


"Yossi" wrote in message
...
Hi,
I am trying to set a range variable with a defined range, but I get this
error all the time:
"Run-time error '1004':
Application-defined or object-definned error."

the code is this:
Sub temp()
Dim MyRange As Range

Set MyRange = Names("temp").RefersToRange
.
.
.
End Sub

I can't figure it out. Can you help?






All times are GMT +1. The time now is 11:58 PM.

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