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

Excel 2003: "Current Sheet" isn't "ActiveSheet"

Status
Not open for further replies.

Kimed

Programmer
May 25, 2005
104
LT
Hi,

I have a multi-sheet table with combo boxes that have xxx_Change() subs defined. Sometimes these subs launch by themselves (for example, it may happen during startup when control's contents is being initialized, etc.) when the sheet with a related control isn't the currently selected sheet, which creates havoc. I was able to cage it by including the line

If ActiveSheet.Name <> "<sheet's name>" Then Exit Sub

in the beginning of each such sub, but for certain reasons I don't find including sheet's name as a string literal a convenient method anymore. Is there a different method to unambiguously define the sheet in which a sub is described? I'm thinking about

If ActiveSheet.Name <> this_control_name.Parent.Name

which seemingly *does* work in a sandbox, but the problem is that I have multiple boxes with same names across different pages (that I wouldn't like to rename unless really necessary) and I suspect it might make defining ambiguous. Is there any other method I could also try?

Thanks
 



Hi,

Please repost VBA questions in forum707.

Please include all your code, so we can see whats happening.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top