View Full Version : Display warning alerts
Chris2460
08-29-2016, 11:39 AM
Hello I wonder if anyone can help I have a simple spreadsheet that requires question to be answeard certain cells "A1" for example, my question is how do I get WARNING/ERROR message to appear if a user fails to answear the question and closes the sheet.
This goes in the Sheet Code Module.
Option Explicit
Private Sub Worksheet_Deactivate()
Dim RequiredCells As Variant
Dim i As Long
RequiredCells = Array("A1", "B2", "C3", "D4", etc)
For i = LBound(RequiredCells) To UBound(RequiredCells)
If Range(RequiredCells(i)) = "" Then
MsgBox "You must answer all questions before closing the sheet"
Me.Activate
Range(RequiredCells(i)).Select
Exit For
End If
Next i
End Sub
Chris2460
08-29-2016, 12:22 PM
Many thanks for your help, that works a treat.......
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.