Been playing around with this code for an hr now and cant get my head around it, The code works however when you start out, the button is already called Anounced but does not run the macro untill you click it to do Unanounced and then click it back a second time to display anounced and run that coresponding macro.
Is there a way to:
a) Make it run atleast once which ever state the button is in? caption "Anounced" or Caption "Unannounced" so that atleast once when file is loaded it will run so caption shown will have atleast had that macro ran atleast once?
And
b) add a type of start caption, (3rd caption) for example "SELECT" which if a) is working would run Macro3 "SELECT" atleast once on load up and allow the "Anounced" and "Unanounced" to be selected?
(this code was borrowed
from somebody else but i can not recall which post it was from as visited lots of sites)
Public Sub ButtonControl()
With ActiveSheet.Buttons("Button 1")
If .Caption = "Anounced" Then
Call Macro1
.Caption = "Unanounced"
Else
Call Macro2
.Caption = "Anounced"
End If
End With
End Sub
any help appreciated.
Bookmarks