Hi XL'ers

I am using XL2003

This is a follow-on from a previous post.

 

I refer to the use of the following (meaningless) Worksheet Window macro:

 

Private Sub Worksheet_Activate()
With Range("CompNames")
End With
End Sub

 

If the named range (CompNames) is on the sheet being actived, the code runs ok.

If the named range is not on the sheet being activated, I get the following 
error:

 

Runtime error '1004'

Application-defined or object-defined error

 

If the 2 code lines are put into normal macro in a module, the error does not 
occur.

I have discovered that I can get around this by using:

 

Private Sub Worksheet_Activate()
With [CompNames]
End With
End Sub

 

But I can't find any reference to this style of notation in the Help. Someone 
in this group mentioned it, and I tried it out of desperation.

Has anyone else had this problem, or can anyone else confirm that this is so? 
It's been driving me nuts.

 

Regards - Dave.
                                          
_________________________________________________________________
Use Messenger in your Hotmail inbox Find out how
http://windowslive.ninemsn.com.au/hotmail/article/823454/web-im-for-hotmail-is-here

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe

Reply via email to