Match word in row, then conditional format other rows based on matched column value EXCEL

Binho

New Member
Joined
Jun 7, 2011
Messages
1
I have a spreadsheet where i want to search for the word "Total" in column headings, then look down the column that matched for "Total", find any row that has a value greater than 1 and highlight the row. The reason for searching for "Total" is that more columns may be added at any time but there will always be a "Total" column, and I will always want to highlight that row if the total is greater than 0.


I got very confused using the MATCH function :eek:. Any help would be appreciated.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Welcome Binho,

Here is what I suggest:

Assuming that the word "Total" appears once:

Code:
Sub test()Dim acol As Long
Dim i As Integer
For i = 2 To 9999
  acol = Application.Match("Total", Sheets("Sheet1").Range("A1:BZ1"), 0)
  If Cells(i, acol).Value > 0 Then
    Cells(i, acol).Interior.ColorIndex = 8
  End If
Next i
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,737
Messages
6,132,434
Members
449,727
Latest member
Aby2024

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