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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy Excel selecting range question

Status
Not open for further replies.

majordog

Programmer
Jul 8, 2002
222
0
0
CA
Hey All,
I run this code:

Windows("EC1997-002 031904 calc1.xls").Activate
Windows("03190930.04").Activate
Windows("03190935.04").Activate
Windows("03190940.04").Activate
Windows("03190945.04").Activate
Windows("03190950.04").Activate
Windows("03190955.04").Activate
Windows("03191001.04").Activate
Windows("03191006.04").Activate
Windows("03191012.04").Activate
Windows("03191017.04").Activate
Windows("03191022.04").Activate
Windows("03191027.04").Activate
Windows("03191031.04").Activate
Windows("03190930.04").Activate
Range("A1").Select

And when I try to step into the last line I get the error:
Run-Time error '1004' Application-defined or object - defined error

Can anyone tell why? What am I missing, I thought that it would automatically know that I am referencing the last window I activated.
 
The Range without object qualification mean ActiveSheet.Range. Are you sure you have an activesheet when the error raise ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Is the active sheet in your last window a worksheet?
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
In the Immediate Window you could try typing

?ActiveSheet.Name

Just to check if this reference is working.
 
Hi majordog,

Where is this code? It might work if it is in a Module, but it will fail if it is in a Sheet's (or Workbook's) Code; it can only default when there is no conflict in possible interpretations.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Tony,

I would think that instead of giving an error it would just use the object it finds in the scope of the running code.
 
ESquared,

From many threads here there is obvious confusion about both what it does and what it should do; perhaps raising an error is best in the circumstances. Can't say much more till we hear from majordog again.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top