ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking the Value of a Check Box in a Macro (https://www.excelbanter.com/excel-programming/439451-checking-value-check-box-macro.html)

ScottL

Checking the Value of a Check Box in a Macro
 
I have a macro that hides a named range on rows. I also have a check box.
If the check box is checked I want an error message to display and tell the
user to clear the check boxes before teh rows will hide.

'
' Hide Spec_Plu_22_10_00
'
Sub Hide_Spec_Plu_22_10_00()
'Unprotect Time Sheet
ActiveSheet.Unprotect
If CheckBox135 = True Then
MsgBox "Uncheck boxes in spec section your trying to close.",
vbInformation, "Alert Message"
GoTo 300
Else
GoTo 200
End If
'Hide Rows
200 Range("Plu_22_10_00").Select
Selection.EntireRow.Hidden = True
'Protect On
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios _
:=True
300 End Sub


All times are GMT +1. The time now is 08:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com