C
CindyB
I posted a question earlier this week about how to force a user to enter data
in a cell. Gary''s Student - gsnu200775 provided the following reply:
"Put the following line in a standard module:
Public checkit As Boolean
Put the following worksheet event macro in the worksheet code area:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set b9 = Range("B9")
Set t = Target
If Intersect(t, b9) Is Nothing Then
If checkit Then
If b9.Value = "" Then
Application.EnableEvents = False
b9.Select
Application.EnableEvents = True
Else
checkit = False
End If
End If
Else
checkit = True
End If
End Sub"
Which works beautifully!! Thank you Gary. However I have two more questions:
1. How do I change the code to provide an error message to the user that
they have to enter data in the cell
2. How do I change the range so that I can say force data entry for all
column 'B' cells from row 9 - row 50.
Any help would be greatly appreciated!!!
Cindy Butler
in a cell. Gary''s Student - gsnu200775 provided the following reply:
"Put the following line in a standard module:
Public checkit As Boolean
Put the following worksheet event macro in the worksheet code area:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set b9 = Range("B9")
Set t = Target
If Intersect(t, b9) Is Nothing Then
If checkit Then
If b9.Value = "" Then
Application.EnableEvents = False
b9.Select
Application.EnableEvents = True
Else
checkit = False
End If
End If
Else
checkit = True
End If
End Sub"
Which works beautifully!! Thank you Gary. However I have two more questions:
1. How do I change the code to provide an error message to the user that
they have to enter data in the cell
2. How do I change the range so that I can say force data entry for all
column 'B' cells from row 9 - row 50.
Any help would be greatly appreciated!!!
Cindy Butler