I have vba code (Sub CheckBox1_Click() ) that looks for a checked checkbox. When the checkbox is checked my variable =1 else the variable is 0.
When the workbook is clicked to close by the user (Sub Workbook_BeforeClose) and the checkbox was checked, a message pops up to inform the user of an additional worksheet that needs to be completed.
The problem is that I cannot get the value of the variable to pass from the "checkbox click" module to the "workbook close" module.
See code below...
-------------------------------------------------------------------------------------
Public multiplecostcenters As Long
Sub CheckBox1_Click()
If CheckBox1.Value = True Then
multiplecostcenters = 1
End If
If CheckBox1.Value = False Then
multiplecostcenters = 0
End If
End Sub
-----------------------------------------------------------------------------------
Sub Workbook_BeforeClose(Cancel As Boolean)
If multiplecostcenters = 1 Then
MsgBox ("Please complete the Profit Center information required on worksheet tab: Profit Centers")
End If
----------------------------------------------------------------------------------
Thanks for your expertise.
When the workbook is clicked to close by the user (Sub Workbook_BeforeClose) and the checkbox was checked, a message pops up to inform the user of an additional worksheet that needs to be completed.
The problem is that I cannot get the value of the variable to pass from the "checkbox click" module to the "workbook close" module.
See code below...
-------------------------------------------------------------------------------------
Public multiplecostcenters As Long
Sub CheckBox1_Click()
If CheckBox1.Value = True Then
multiplecostcenters = 1
End If
If CheckBox1.Value = False Then
multiplecostcenters = 0
End If
End Sub
-----------------------------------------------------------------------------------
Sub Workbook_BeforeClose(Cancel As Boolean)
If multiplecostcenters = 1 Then
MsgBox ("Please complete the Profit Center information required on worksheet tab: Profit Centers")
End If
----------------------------------------------------------------------------------
Thanks for your expertise.