jaimed77089
New Member
- Joined
- Nov 3, 2005
- Messages
- 10
I am looking to add a warning that will pop up, if a cell is not filled in with a Y. The cell should be completed before the workbook is closed. Is there a way to do this?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim rng As Range
Dim EditorList As Range
Set EditorList = Sheets("Users").Columns("A:A")
If WorksheetFunction.CountIf(EditorList, Environ("username")) > 0 Then
Set rng = Sheets("Sheet1").Range("A1")
If rng <> LCase("y") Then
msg = "Cell " & rng.Address & " on " & rng.Worksheet.Name & " must be filled in!"
Style = vbCritical + vbOKOnly
Title = "Hey, You Forgot Something!"
pt = MsgBox(msg, Style, Title)
Application.Goto rng
Cancel = True
End If
End If ' countif
End Sub
Private Sub Workbook_Open()
' Code here
End Sub