How to force data entry with error messages

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
 
C

CindyB

Okay -

I have answered question 1. I still need some help with question 2: 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.


Thanks - Cindy
 

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