You can do this with worksheet event code to show/hide it. Assuming that you
have a button called MyButton on the formatting menu, here is some code to
do it. This goes in the worksheet code module, right-click the sheet tab,
select View Code from the menu, and paste the code in
Private Sub Worksheet_Activate()
With Application.CommandBars("Formatting")
With .Controls("myButton")
.Visible = True
End With
End With
End Sub
Private Sub Worksheet_Deactivate()
With Application.CommandBars("Formatting")
With .Controls("myButton")
.Visible = False
End With
End With
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
To add additional controls to the code what adjustment is required?
I have tried the following which is not correct:
Private Sub Worksheet_Activate()
With Application.CommandBars("Formatting")
With .Controls("myButton" , "myButton2")
.Visible = True
End With
End With
End Sub
Hi Pat
one way:
Private Sub Worksheet_Activate()
With Application.CommandBars("Formatting")
With .Controls("myButton")
.Visible = True
End With
With .Controls("myButton2")
.Visible = True
End With
End With
End Sub
Private Sub Worksheet_Activate()
With Application.CommandBars("Formatting")
With .Controls("myButton" )
.Visible = True
End With
With .Controls("myButton2" )
.Visible = True
End With
End With
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
Private Sub Worksheet_Activate()
With Application.CommandBars("Formatting")
.Controls("myButton").Visible = True
.Controls("myButton2").Visible = True
End With
End Sub
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.