Finding the Max number

emmcee

New Member
Joined
Sep 9, 2011
Messages
29
Hello guy,

I'm suppose to find the PEAK_POWER (max number) from a list of unknown number of range of unknown numbers and let it store in a cell B17,

So far I got this, which works:

Sub PEAK_POWER()

Range("B17").Value = WorksheetFunction.Max(Range("F3:F34"))

End Sub

but Assume that I don't know the range of F3 to F34, How can I adjust that code so that when i do run it somewhere else it would work, assuming we don't know the range.

Thanks!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try like this

Code:
Sub PEAK_POWER()
LR = Range("F" & Rows.Count).End(xlUp).Row
Range("B17").Value = WorksheetFunction.Max(Range("F3:F" & LR))
End Sub
 
Upvote 0
I'm not sure, I was told that there is a code the can be used for this so that any range used such as from A2 to A100 can still get an answer
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,136
Members
452,890
Latest member
Nikhil Ramesh

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