Finding the max of a range where numbers are stored as text using VBA

PC_Meister

Board Regular
Joined
Aug 28, 2013
Messages
72
Hello,

I am wondering if there is a way to find the max of a range using VBA, I have thought of using the "max" worksheet function, but the problem is I have a range where the numbers are stored as text. I could convert the text to numbers and then run the max function but I would like to keep them stored as text. Any ideas?

Thanks
 
I am wondering if there is a way to find the max of a range using VBA, I have thought of using the "max" worksheet function, but the problem is I have a range where the numbers are stored as text.
Try it this way...

MaxVal = Evaluate("MAX(0+A1:A100)")

Change the range to suite your needs.
 
Upvote 0
Thx Rick, but I am looking for a VBA solution if possible.
That is a VBA solution... MaxVal is an assumed variable name (you did not actually tell us what variable to assign the max value to, so I made up a name) and the value from the Evaluate function is being assigned to it.
 
Last edited:
Upvote 0

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