I need to expand my code for mandatory cell entry - Need help!!
Cindy, the easiest way is to create a range name for the ranges and call it
say InputRange. The Named range will look something like
=Sheet5!$F$3:$C$50,Sheet5!$g$3:$F$50,Sheet5!$I$3:$ I$50
then just change the code to
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set colf = Range("InputRange")
Should still work perfectly
Peter
"CindyB" wrote:
I have inserted the following code into my workbook to force data entry in F3
in my worksheet - thanks to some wonderful help from members of this forum it
works perfectly!!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set colf = Range("F3")
Set t = Target
If Intersect(t, colf) Is Nothing Then
If Checklit Then
If colf.Value = "" Then
Application.EnableEvents = False
colf.Select
Application.EnableEvents = True
Else
Checklit = False
End If
End If
Else
Checklit = True
End If
End Sub
However, I now need to be able to force data entry whenever the user clicks
on the following ranges: F3:f50, G3:g50, and I3:I50.
Can someone help me? I'm so frustrated........
Thanks - Cindyb
|