Selecting the largest valued cell using VBA

ifu06416

Board Regular
Joined
Sep 5, 2011
Messages
56
Office Version
  1. 365
Hi there

I've looked around for solution to this but surprisingly couldn't find one.

I would like to build a macro that selects the largest valued cell in column A.

it should be easy enough but i guess im not describing it right in my google searches.

Regards,

John.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi John. Are you trying to find the largest value in the column or the cell that has the largest value? If the former, I recommend reading up on the LARGE function. If the latter, an important question would be whether your data is sorted by that column or not and how many rows you are typically dealing with.
 
Upvote 0
Try this....

Code:
Sub test()

Dim rng As Range
Set rng = ActiveSheet.Range("A:A").Find(LookIn:=xlValues, What:=Application.WorksheetFunction.Max(ActiveSheet.Range("A:A")))
If Not rng Is Nothing Then
    rng.Select
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,091
Messages
6,128,775
Members
449,468
Latest member
AGreen17

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