MAX of Highlighted Cells

Whylucky

New Member
Joined
Sep 24, 2013
Messages
39
So i have a code that is highlighting cells based on a case selection made by the user. After the cells have been highlighted though i would like to find the maximum of the highlighted cells in there own respective columns. Is there a way in my counter that every time it highlights it remembers the row to pll down later or is there an overall way of just finding the max of only highlighted cells? I attached the beginning of the code so you can get an idea of what i am trying to do. Thank you in advance.

Code:
If loadout = 1 Then


    Range("R8").Select
    Range("R8").End(xlDown).Select
    b = ActiveCell.Row
    Range("A7:T" + CStr(b)).Select
    With Selection.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With


Range("V8").Select
Range("V8").End(xlDown).Select
a = ActiveCell.Row


For i = 8 To a
Range("V" + CStr(i)).Select


 If InStr(1, ActiveCell.Text, "B") Then
        With Range("O" & ActiveCell.Row).Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .color = 65535
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
    End If
        
    If InStr(1, ActiveCell.Text, "C") Then
        With Range("P" & ActiveCell.Row).Interior
            .Pattern = xlSolid
            .PatternColorIndex = xlAutomatic
            .color = 65535
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
 

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