ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Requiring Cell Input (https://www.excelbanter.com/excel-programming/429347-requiring-cell-input.html)

scott

Requiring Cell Input
 
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

Don Guillett

Requiring Cell Input
 
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scott" wrote in message
...
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



Don Guillett

Requiring Cell Input
 
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Scott" wrote in message
...
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




All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com