rrtts
12-21-2006, 12:38 PM
I'm trying to create a macro that will custom format cells that contain a keyword and leave any blank cells or cells with a value different than the keyword unchanged.
The data is always in column A with a range of A5 to A78. The keywords will be in various rows - there will be nearly 30 rows in all that contain the keyword.
The custom format I am trying to achieve is:
Select a group of cells, merge, bold, left/top justification and put a border around it. (I've attached a sample file.)
I've searched the help file and through the the forums...I've been able to modify the below code (from the VBE help file) to find all of my keywords and I've been able to record a macro that gives me the code for the custom format, but I'm having a hard time figuring out how to tie the two together.
With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Any help would be greatly appreciated.
The data is always in column A with a range of A5 to A78. The keywords will be in various rows - there will be nearly 30 rows in all that contain the keyword.
The custom format I am trying to achieve is:
Select a group of cells, merge, bold, left/top justification and put a border around it. (I've attached a sample file.)
I've searched the help file and through the the forums...I've been able to modify the below code (from the VBE help file) to find all of my keywords and I've been able to record a macro that gives me the code for the custom format, but I'm having a hard time figuring out how to tie the two together.
With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Any help would be greatly appreciated.