Public OLDVAL As Variant
Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("A1") _
And IsEmpty(Target) Then Target = OLDVAL
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
OLDVAL = Target.Value
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address > [c4].Address Then
If IsEmpty([c4]) Then
MsgBox "Cell C4 Must Have A Value." _
, vbCritical, "There Is A Problem!"
[c4].Select
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address > [c4].Address Then
If IsEmpty([c4]) Then
MsgBox "Cell C4 Must Have A Value." _
, vbCritical, "There Is A Problem!"
[c4].Select
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
For Each cl In Me.UsedRange.Cells
If cl.Locked = False Then
adr = cl.Address
Exit For
End If
Next
Application.ScreenUpdating = False
Application.EnableEvents = False
If Not Target.Locked Then
If IsEmpty(Target.Previous) Then
If Target.Address <> adr Then
Target.Previous.Select
End If
End If
End If
Application.EnableEvents = True
End Sub
Hi,
The below code works for all unlocked cells in a protected worksheet:
Hope this helps.Code:Private Sub Worksheet_SelectionChange(ByVal Target As Range) For Each cl In Me.UsedRange.Cells If cl.Locked = False Then adr = cl.Address Exit For End If Next Application.ScreenUpdating = False Application.EnableEvents = False If Not Target.Locked Then If IsEmpty(Target.Previous) Then If Target.Address <> adr Then Target.Previous.Select End If End If End If Application.EnableEvents = True End Sub