View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
cindyb cindyb is offline
external usenet poster
 
Posts: 8
Default 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?