Hello everyone...
I found VBA code to color the active cell and it worked in an unprotected sheet.
I want to use it in a protected sheet where I can input only on several cells and in this sheet I also have another VBA code.
When I put this code, it didn't work but I don't know where the problem is. It always stop at this part -> Cells.Interior.ColorIndex = 0
Can someone point me where the problem is?
Thanks in advance.
I found VBA code to color the active cell and it worked in an unprotected sheet.
I want to use it in a protected sheet where I can input only on several cells and in this sheet I also have another VBA code.
When I put this code, it didn't work but I don't know where the problem is. It always stop at this part -> Cells.Interior.ColorIndex = 0
Can someone point me where the problem is?
Thanks in advance.
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim rFound As Range
If Not Intersect(Target, Range("I4:I29")) Is Nothing Then
If Len(Target.Value) > 0 Then
Cancel = True
Set rFound = Sheets("Item list").Columns("W").Find(What:=Target.Value, LookAt:=xlPart)
If rFound Is Nothing Then
MsgBox Target.Value & "Not found"
Else
Application.Goto Reference:=rFound, Scroll:=True
rFound.EntireRow.Select
End If
End If
End If
If Not Intersect(Target, Range("K4:K29")) Is Nothing Then
If Len(Target.Value) > 0 Then
Cancel = True
Set rFound = Sheets("Item list").Columns("A").Find(What:=Target.Value, LookAt:=xlWhole)
If rFound Is Nothing Then
MsgBox Target.Value & "Not found"
Else
Application.Goto Reference:=rFound, Scroll:=True
rFound.EntireRow.Select
End If
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Cells.Interior.ColorIndex = 0
Target.Interior.Color = vbCyan
Application.ScreenUpdating = True
End Sub