ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Fprced data entry on multiple worksheets (https://www.excelbanter.com/excel-worksheet-functions/194824-fprced-data-entry-multiple-worksheets.html)

cindyb

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?



All times are GMT +1. The time now is 01:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com