Field Required if another field is checked

K

** Kelly ********

"F14 Required if F22 or F23 is checked unless it already
has information in it."
Here what I want to do

If F14 hasn't got any information in it and you Enter an X
in F22 or F23 which turns F14 red. and automatically
places the curser or tabs to F14. Then you enter
information in F14 and F14 loses it red color.
If F14 has information in it then the above is ignored and
you proceed like normal to the next field.

This is a big one so THANKS A BUNCH.

Using
Office 2000
NT 4.0
 
S

steve

Kelly,

Right click on the sheet tab and paste this into the worksheet module

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$F$22" Or Target.Address = "$F$23" Then
If UCase(Target) = "X" Then
If Len(Range("F14")) = 0 Then
Range("F14").Interior.ColorIndex = 3
Range("F14").Select
MsgBox ("Make an entry")
End If
End If
End If
End Sub

note the MsgBox to alert the user to make an entry.

You can make this more generic so that it will work on any field.
Instead of Target.Address you can use Target.Row = 22 and
Target.Row = 23. Instead of Range("F14") you can use
Cells(14,Target.Column)

And you can restrict it with another If
If Target.Column > 5 then
....
 

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