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