Selecting a cell from an index

C

Canuck

Hello,
I'm looking to set a cell as the 'activecell' from an index of cells.
What I need is when activating a command button it sets as the activ
cell in a range of cells the one with the highest value.

For example: A1 = 1, A2 = 3, A3 = 10, A4 = 6
utilizing the command button sets A3 as th
activecell

any help would be appreciate
 
F

Frank Kabel

Hi
try something like the following:

Sub select_high()
Dim row_index As Long
Dim rng As Range
Set rng = ActiveSheet.Range("A1:A10")
With Application.WorksheetFunction
row_index = .Match(.Max(rng), rng, 0)
End With
ActiveSheet.Cells(row_index, "A").Select
End Sub
 
Top