Required entries

patricknoreene

New Member
Joined
Apr 16, 2002
Messages
1
I am trying to figure out how to make users enter data in certain fields before they can move to next entry. My Comments section must have data. I tried to use data validation, but it only works if you actually enter data and then it is checked to see if the data is valid. But, Excel will allow you to enter thru that section without stopping.
How can I get Excel to not allow the user to go any further until they have entered data in this field (Comment)?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
This code will require that a value be entered in a cell. Substitute the correct cell addresses.

Option Explicit
Dim Required As Range

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Cells.Count > 1 Then Exit Sub
Select Case Target.Address
Case "$A$5", "$A$10", "$A$15", "$A$20", "$A$25", "$A$30"
Set Required = Target
Case Else
If Not Required Is Nothing Then
If Required = "" Then
Required.Select
MsgBox "You cannot leave this cell blank"
End If
End If
End Select

End Sub

Place this code in the Sheet module
This message was edited by lenze on 2002-04-17 06:36
 
Upvote 0

Forum statistics

Threads
1,214,419
Messages
6,119,389
Members
448,891
Latest member
tpierce

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top