NuJoizey
New Member
- Joined
- May 18, 2007
- Messages
- 7
A user mistakenly clicks a checkbox from False to True. I want a message box to pop up saying "Are you sure?" If user responds "NO" then I want to exit out of the routine and set the checkbox back to False. But the problem is that when I do this, the event is re-fired and AddCols() procedure keeps getting called - but I don't want this to happen. So then, how are you supposed to capture a mistake by user and roll back the action? This is driving me crazy!
Private Sub chk_Change()
If Me.chk.Value = True And Range("D14") > 1 Then
'delete everything from column e to the last column where there is data entry
If MsgBox("Are you sure?") = vbYes Then
Call DeleteCols()
Else
'reset the checkbox
Me.chk.Value = False
Exit Sub
End If
Else
'I DON'T WANT THIS TO BE CALLED IF THE USER ANSWERS "NO" TO "ARE YOU SURE"
Call AddCols()
End If
End Sub
Private Sub chk_Change()
If Me.chk.Value = True And Range("D14") > 1 Then
'delete everything from column e to the last column where there is data entry
If MsgBox("Are you sure?") = vbYes Then
Call DeleteCols()
Else
'reset the checkbox
Me.chk.Value = False
Exit Sub
End If
Else
'I DON'T WANT THIS TO BE CALLED IF THE USER ANSWERS "NO" TO "ARE YOU SURE"
Call AddCols()
End If
End Sub