This is my sample block. "HP" marks value > 11300. How do I find maximum value in HP range and mark the word "MAX" next to it. How do I loop through the whole worksheet?
ColA ColB ColC
================================
10966.327
11176.779
11267.391
11305.390 HP
11404.770 HP
11477.844 HP
11485.638 HP MAX
11442.769 HP
11451.537 HP
11444.717 HP
11443.742 HP
11437.896 HP
11446.665 HP
11441.794 HP
9301.220
8962.157
8653.299
8335.671
8030.710
7735.492
7376.943
================================
Sub findMax()
While ActiveCell.Offset(0, -2).Value > 0 'activecell is col C
If ActiveCell.Offset(0, -1).Value = "HP" Then
'find maximum value
'I don't know the syntax here:
'If ActiveCell.Offset(0, -1) Is max Then ActiveCell.Offset(-1, 1).Value = "MAX"
End If
ActiveCell.Offset(1, 0).Select
Wend
End Sub
ColA ColB ColC
================================
10966.327
11176.779
11267.391
11305.390 HP
11404.770 HP
11477.844 HP
11485.638 HP MAX
11442.769 HP
11451.537 HP
11444.717 HP
11443.742 HP
11437.896 HP
11446.665 HP
11441.794 HP
9301.220
8962.157
8653.299
8335.671
8030.710
7735.492
7376.943
================================
Sub findMax()
While ActiveCell.Offset(0, -2).Value > 0 'activecell is col C
If ActiveCell.Offset(0, -1).Value = "HP" Then
'find maximum value
'I don't know the syntax here:
'If ActiveCell.Offset(0, -1) Is max Then ActiveCell.Offset(-1, 1).Value = "MAX"
End If
ActiveCell.Offset(1, 0).Select
Wend
End Sub