rdoulaghsingh
Board Regular
- Joined
- Feb 14, 2021
- Messages
- 105
- Office Version
- 365
- Platform
- Windows
Is there a line of code I can add to the script below to lock/disable the offset cells form being edited without having to lock/protect the entire workbook?
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = 1 Then
If Not Intersect(Target, Range("C3:C13,C18:C28")) Is Nothing Then
Application.EnableEvents = False
If Target.Value = "N/A" Then
With Target(1, 0)
.Value = "(N/A)"
With .Interior
.Pattern = xlLightDown
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End With
Else
With Target(1, 0)
.Value = ""
With .Interior
.Pattern = xlPatternNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End With
End If
Application.EnableEvents = True
End If
End If
End Sub