View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] donna.gough@hydro.com is offline
external usenet poster
 
Posts: 81
Default Can You Change A CommandButton Code Using A Macro?

Thanks Tom, Your code gave me an idea to shorten/eliminate the need to
change range B to E which is great but I still need to change some of
the CommandButton Code and I am not fully understanding your code. My
code so far is:-

Private Sub ABC_Click()
d = ActiveSheet.Name
Sheets("ABC").Select
Sheets(d).Visible = False
End Sub

Basically I have a button that activates a sheet and hiding the first
one. This code and button is part of a Master Sheet. I have a main
macro that copies this sheet and renames it. I now want to change the
"ABC" to another sheet name. I have this sheet name in a string (Sht)
(from the main macro) and want to use it to change the code of the
CommandButton.

I don't know if your code can help me do this..if so could you explain
how this is possible.

Thanking you again for your help.