Hi
I have a solution for you:-
This code is sheet specific and looks for a double click in column F and then kicks off the main program.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Count > 1 Or Target.Column <> 6 Or Target.Row = 1 Then Exit Sub
Call Highlighter(Cells(Target.Row, 2).Value)
End Sub
This is your main code:-
Sub Highlighter(customer As String)
'
' Highlighter Macro
'
On Error Resume Next
Sheets("Sheet2").Select
Cells.Select
With Selection.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Columns("C:C").Select
Selection.Find(What:=customer, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
If ActiveCell.Value = customer Then
Rows(ActiveCell.Row & ":" & ActiveCell.Row).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
Range("A1").Select
Sheets("Sheet1").Select
MsgBox "Item Not Found", vbOKOnly, "Error"
End If
End Sub
Bookmarks