Requiring Cell Input

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

Hello,

I have a spreadsheet that I use as a form. I'd like to make a madatory field
that requires input in cell A1. Any ideas on how to require input?

I have one idea to say "when user tries to save, if cell A1 is empty, show a
message box that states 'Input required in cell A1.' "

I'm open to other ideas too. The easier the solution the better as I'm not a
VBA programmer.

Scott
 
Try this in the ThisWorkbook module

Private Sub Workbook_BeforeSave _
(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Set magiccell = Sheets("sheet2").Range("a1")
If Len(Application.Trim(magiccell)) < 1 Then
Application.Goto magiccell
MsgBox "Fill in required cell"
Cancel = True
End If
End Sub
 
Back
Top