View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] HammerJoe@gmail.com is offline
external usenet poster
 
Posts: 126
Default Why doesnt this work?

Dim MainWorksSheet As Worksheet
Set MainWorksSheet = ThisWorkbook.Worksheets("Main") *Yes the
worksheet is named Main.

MainWorksSheet.CommandButtonAdd.Enabled = True
MainWorksSheet.CommandButtonMakeBusy.Caption = "Start"

**Both being a button created with the control toolbox.

I get the error : Method or Data member not found.

On the other hand :

ActiveSheet.CommandButtonAdd.Enabled = True
ActiveSheet.CommandButtonMakeBusy.Caption = "Start"

Works fine! Unless the focus is on a different sheet named something
else.

I need to make sure that it refers to the sheet "Main" because I have
other sheets and if they have the focus then the ActiveSheet doesnt
work either.
Thanks for any help.