Max Value within filtered range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to return the MAx value in a filtered column using the following,
but I cannot get any data into my spreadsheet.
Help!

Thanks
J

xlApp.Selection.AutoFilter
xlApp.Selection.AutoFilter Field:=26, Criteria1:="FALSE"
'==================== Check For Earned Value Numbers
========================================
xlApp.Sheets("Tasks").Select
z = xlApp.ActiveSheet.UsedRange.Row - 1 +
xlApp.ActiveSheet.UsedRange.Rows.Count
xlRng = xlApp.Range(xlApp.Cells(4, 12), xlApp.Cells(z, 12)).Select
xlApp.Sheets("Top Sheet").Select
xlApp.Range("G19") = xlApp.WorksheetFunction.Max(xlRng)
xlApp.Sheets("Tasks").Select
xlApp.Selection.AutoFilter
 
=subtotal(4,range)

which can be used in code as well

mymax = application.Subtotal(4,Range("B2:B100"))
 
set xlRng = xlApp.Range(xlApp.Cells(4, 12), xlApp.Cells(z, 12))
xlApp.Sheets("Top Sheet").Select
xlApp.Range("G19") = xlApp.WorksheetFunction.Subtotal(4,xlRng)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top