find entire string then row background red
Hi Andrea,
Hope the below code helps!!!
Sub test()
Dim i As Integer
Dim mSearch As String
On Error GoTo HandleError
'This is your search string
mSearch = "test"
'Search for the string in column A
i = WorksheetFunction.Match(mSearch, Range("A:A"), 0)
'If found select the entire row
Range("" & i & ":" & i & "").Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Range("A" & i).Select
HandleError:
End Sub
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!
" wrote:
Hi Everyone
I dont know how easy this is but I wondered if this can be done in
code.
I need a macro to look down column A and search for an extract string
of text.
Everytime it finds a match it is then to highlight the row and format
the background of the row a specified colour.
I want to be able to use this macro for different string to colour all
my data.
I hope someone can help,
Many thanks
Andrea
|