Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application-defined or object-defined error

Status
Not open for further replies.

pho01

Programmer
Mar 17, 2003
218
US
On my Excel macro, I had:

Set r1 = Sheet1.Range(Cells(2, 1), Cells(1000, 3))

Step into the code, it returns error
Run-time error '1004': Application-defined or object-defined error

Any idea why it is complaining that?

FYI: This is regarding to testing the script on the posting:

THanks!
 





Try this, referencing all range objects...
Code:
Set r1 = Sheet1.Range(Sheet1.Cells(2, 1), Sheet1.Cells(1000, 3))
or
Code:
with Sheet1
  Set r1 = .Range(.Cells(2, 1), .Cells(1000, 3))
end with


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Or:
Set r1 = Sheet1.Range("A2:C1000")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top