Fprced data entry on multiple worksheets
I am trying to force data entry on specific cells within a worksheet before
the user can leave the cell. I was working on this and got my code to this
point, and it works great - as it is only in one worksheet:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(rLast, Range("D4, F4")) Is Nothing Then
If IsEmpty(rLast.Value) Then
With Application
.EnableEvents = False
.Goto rLast
MsgBox "No empty cells, Cowboy"
.EnableEvents = True
End With
End If
End If
Set rLast = Selection(1, 1)
End Sub
However, when I try to put this code in multiple worksheets, and just change
my range to fit the specific worksheet cells, I get a run time error. Can
someone help me out here to make this work for multiple worksheets within the
same workbook?
|