Requiring Cell Input

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
 
D

Don Guillett

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top