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.
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
54,503
Office Version
  1. 365
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,400
Messages
5,528,518
Members
409,821
Latest member
decibelpilot

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top