VBA cacro to find next conditionally highlighted cell

eldcampo

New Member
Joined
Jul 12, 2011
Messages
8
I am wondering if anyone knows a way using VBA to cycle through a spreadsheet, finding cells that have been highlighted due to the results of conditional formatting?

The spreadsheet I'll be using it in is quite large and I'd like to make it easier for my users to navigate to each of the highlighted cells.

Please let me know of any ideas!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Maybe like this

Code:
Sub atest()
Dim c As Range, r As Range
Set r = ActiveSheet.UsedRange.SpecialCells(xlCellTypeAllFormatConditions)
For Each c In r
    c.Select
    MsgBox "Click OK to continue"
Next c
End Sub
 
Upvote 0
Thanks! That helps go from one conditional cell to the next - is there a way for it to go to the cells that were TRUE and thus were highlighted?
 
Upvote 0
Thanks very much for your help. Just out of curiosity, do you think we could we revise the following code to apply the highlighting directly to the cells, not through conditional formatting?

Code:
With Range("O5:FE500")
        .FormatConditions.Add Type:=xlExpression, Formula1:="=SUMPRODUCT(--(ISNUMBER(SEARCH(Keywords1,RC))))"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .Color = 49407
                .TintAndShade = 0
            End With
            .StopIfTrue = False
        End With
    End With
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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