Using more than 3 conditional formats with match function for each one

bat18

Board Regular
Joined
Mar 29, 2010
Messages
89
I have 5 columns of different values on a spreadsheet, each day i paste in a set of values into a different column. These values will match to one value in any one of the 5 columns, if it does I need part of the row that value is on to be highlighted.

But depending on which column has been matched to I need to row to be highlighted a different colour. I used to use conditional formatting as i used to only have 3 columns to match to and it worked fine but now i'm stuck. I understand I have to write some sort of VBA code but was hoping for some advice as to how to do it.

Thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi
try these codes
Code:
Sub Bat18()
Dim a As Long, b As Long, x As Long, y As Long
x = Cells(Rows.Count, 6).End(xlUp).Row
On Error Resume Next
    For a = 1 To x
        For b = 1 To 5
        y = Cells(Rows.Count, b).End(xlUp).Row
        Cells(1, 26) = "=match(F" & a & "," & Chr(b + 64) & 1 & ":" & Chr(b + 64) & y & ",0)"
            If Cells(1, 26) > 0 Then
            Cells(Cells(1, 26), b).Interior.ColorIndex = 6
            End If
        Next b
    Next a
MsgBox "complete"
End Sub
it highlights the matching cell yellow. it does not highlight if there are more than one occurance of that word
Ravi
 
Upvote 0
Cheers for the quick reply,

What i'm trying to get is depending on which column the value matches to part of its row will change colour. For example

Values in G, H, I, J, K

I enter a value in column U and it matches to cell K100

I now want cells A100:E100 highlighted red, but if it matched to a cell in column G, H, I or J i would want those cells highlited in a different colour.

Does this make any sense? I am just starting to learn VBA as well so need any help you can give, cheers
 
Upvote 0

Forum statistics

Threads
1,214,881
Messages
6,122,074
Members
449,064
Latest member
MattDRT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top