macros assigned to buttons

G

Greegan

I have added a 'credits' page for those that worked on the workbook before
me. And changes I have made.
I want to have a button that I have added to that Credits worksheet to HIDE
the sheet when selected.
I have recorded a macro to hide that sheet.
However when I select the button it gives me the crosshairs to move the
button. I know I'm missing something here. I also want to be sure that when
I select the button, that it only hides the named sheet.

All help given and to be given is very much appreciated.

G
 
D

Dave Peterson

It sounds like you used a button from the Control toolbox toolbar.

I'd delete it and use the button from the Forms toolbar. Then assign your macro
to that button.

Option Explicit
Sub hideMe()
On Error Resume Next
ActiveSheet.Visible = xlSheetHidden
If Err.Number <> 0 Then
MsgBox "Couldn't Hide Sheet"
Err.Clear
End If
On Error GoTo 0
End Sub


You could put a button on every sheet and assign the same macro to each button.

(This procedure goes in a general module.)
 

Ask a Question

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.

Ask a Question

Top