Simon Lloyd
12-07-2007, 08:50 AM
Hi all, i am using the code below to hide command buttons on sheet activate however it will not hide the last clicked button, is it something to do with removing the focus? Here's the code:
Private Sub Worksheet_Activate()
Dim i As Integer
Dim ib As Integer
ActiveSheet.Rows("6:6").Hidden = False
For i = 1 To 6'i used 2 to 6 but changed to 1 to try to cure the problem
With ActiveSheet.Shapes("CommandButton" & i)
.Visible = False
End With
Next i
ActiveSheet.Shapes("CommandButton1").Visible = True
For ib = 1 To 4
With ActiveSheet.Shapes("Combobox" & ib)
.Visible = True
End With
Next ib
End Sub
Private Sub Worksheet_Activate()
Dim i As Integer
Dim ib As Integer
ActiveSheet.Rows("6:6").Hidden = False
For i = 1 To 6'i used 2 to 6 but changed to 1 to try to cure the problem
With ActiveSheet.Shapes("CommandButton" & i)
.Visible = False
End With
Next i
ActiveSheet.Shapes("CommandButton1").Visible = True
For ib = 1 To 4
With ActiveSheet.Shapes("Combobox" & ib)
.Visible = True
End With
Next ib
End Sub