Selecting a cell from an index

  • Thread starter Thread starter Canuck
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top