Rayne
asked on
Hide button on condition Excel
I have included the worksheet change code as well. So anytime, the worksheet [some] is hidden, the button [btn-1] is hidden. So if worksheet [some] is unhidden, then we can see button [btn_1] visible.
I have a code that’s working but I want it to be very good and never break – because it’s very very important to hide the button when sheet some is hidden – any suggestions or improvements is greatly appreciated. And I want to make sure I am doing that the right way.
Sub Worksheet_Change(ByVal target As Range)
HideOnCondition
End Sub
Sub HideonCondition()
'if worksheet [some] is visible, only then show button [btn_1]
If (Sheet2.Visible = xlSheetVisible) Then
ActiveSheet.Shapes("btn_1" ).Visible = True
Else
ActiveSheet.Shapes("btn_1" ).Visible = False
End If
End Sub
hideButtononCondition.xlsm
I have a code that’s working but I want it to be very good and never break – because it’s very very important to hide the button when sheet some is hidden – any suggestions or improvements is greatly appreciated. And I want to make sure I am doing that the right way.
Sub Worksheet_Change(ByVal target As Range)
HideOnCondition
End Sub
Sub HideonCondition()
'if worksheet [some] is visible, only then show button [btn_1]
If (Sheet2.Visible = xlSheetVisible) Then
ActiveSheet.Shapes("btn_1"
Else
ActiveSheet.Shapes("btn_1"
End If
End Sub
hideButtononCondition.xlsm
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you all for confirming. I justed wanted to make sure I am doing it right. Further, Dave - the workbook selection event was perfect....I cant ask for more :)