Unclear Error Message

G

Guest

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?
 
T

Tom Ogilvy

Sub temp()
Dim MyRange As Range

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

is a possibility.
 

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