I found that the following code is getting max value in range:
Cells(Count, 4)=Application.WorksheetFunction.Max(Range(Cells(m, 1),Cells(n, 1)))
How can I search within a specific sheet? Data
sheet in this case
Like:
Worksheets(d).Cells(x, 4).Value = Worksheets("Data")... ????? FIND MAX ????
You can pass any valid excel cell reference to the range method as a string.
In your case though, use it like this, defining the two cells at the edges of your range:
This will often work, but is missing a reference:
The text "cells" should be preceded by a reference to which worksheet the cells are on, I would write this:
This can also be written like this which is clearer:
I hope this helps.
Harvey
If you want to process quickly milion of cells to find MAX/MIN, you need heavier machinery. This code is faster then
Application.WorksheetFunction.Max
.Stolen from here: https://www.mrexcel.com/forum/excel-questions/132404-max-min-vba.html