View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Restore an invisible commandbutton on open?

You need to be more explicit in your referencing of the buttons. The on open
will be in a general module which by default will act upon the active sheet
(whatever that might be at the time). Try something more like this...

Sub Workbook_Open()
Sheets("Sheet 1").button1.Visible = True
Sheets("Sheet 1").button2.Visible = True
Sheets("Sheet 1").Hide.Visible = True
End Sub

--
HTH...

Jim Thomlinson


"Mike Proffit" wrote:

Hi All. I've got a spreadsheet with a couple of command buttons that launch
vba prcedures. After the user does their stuff, I want a third button that
will hide all three buttons. I've got that part down:

Private Sub Hide_Click()
button1.Visible = False
button2.Visible = False
Hide.Visible = False
End Sub

But I want those three buttons to reappear when the workbook is opened. I've
got an auto-run macro in ThisWorkbook:

Sub Workbook_Open()
button1.Visible = True
button2.Visible = True
Hide.Visible = True
End Sub

On opening the workbook, I get Run-time error '424': Object required.

If I go into design mode, The buttons do appear and I can manually make them
visible again by making their visible property = true. Just want that
automated.

Thanks for any help!