ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Value must be entered (https://www.excelbanter.com/excel-discussion-misc-queries/187725-value-must-entered.html)

JStiehl

Value must be entered
 
Is it possible to require a value to be entered into a cell, and give a
warning if no value is entered? Is it possible to prevent someone who is
entering data in the form from moving to the next cell until this required
data is entered? Thanks for your help.

Gary''s Student

Value must be entered
 
This is an example using cell B9. Once the cell is selected, a value must be
entered before the user can navigate elsewhere.

Put this event macro in the worksheet code area

Public b9 As Boolean

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set r = Range("B9")
If Intersect(Target, r) Is Nothing Then
If b9 Then
If IsEmpty(r) Then
MsgBox ("B9 must be filled")
r.Select
Else
b9 = False
End If
End If
Else
b9 = True
End If
End Sub

--
Gary''s Student - gsnu200786


"JStiehl" wrote:

Is it possible to require a value to be entered into a cell, and give a
warning if no value is entered? Is it possible to prevent someone who is
entering data in the form from moving to the next cell until this required
data is entered? Thanks for your help.



All times are GMT +1. The time now is 10:24 PM.

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