cant find a code for locating maximum value in a column macro

tzexu1610

New Member
Joined
Jan 15, 2018
Messages
15
hi, i have a lot columns of numbers ( A all the way to BZ), and i need to write a macro to locate the cell with maximum value in each column. And i cant use "worksheet.function" as it greatly slows down my code. Wondering if anyone has any suggestions? I tried googling and all i found is using the address, match, max function .Nothing macro related.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I don't know that you can do it efficiently without using "Worksheet.Function". You could do it using loops, but loops are far less efficient than using a "Worksheet.Function".
See: https://stackoverflow.com/questions/5215616/vba-cell-address-of-max

Note that there are other ways to speed up your code, like disabling ScreenUpdating and Automatic Calculations until after your code completes, and making sure that you eliminate (or at least limit) your use of "Select" and "Activate" in your VBA code.

Also, limit your functions so that they are only running against the populated cells in a column, and not the whole entire column.

If you need help making your code more efficient, post it here.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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