View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
TroyW[_2_] TroyW[_2_] is offline
external usenet poster
 
Posts: 94
Default Macro : seeking max value after an Autofilter

Jerome,

Create a formula on the worksheet using the SUBTOTAL function.

If your data is in Column A and B with headers in Row 10 and the data in
Rows 11 to 100 then:
B9: =SUBTOTAL(4,B11:B100)

The value in Cell B9 will recalculate after each AutoFilter and will only
calculate based upon the displayed data. The "4" in the function indicates
to calculate the MAX of the data. See the Excel Help on SUBTOTAL for more
details.

Troy


"Jerome" wrote in message
...
Dear Experts,

My excel sheet encloses 2 columns :
- 1st column is a zip code with Data/Filter/Autofilter on.
- 2nd column is a number
In a macro :
- I filter data of the1st colum using the autofilter (i.e.

Selection.AutoFilter Field:=1, Criteria1:="10080")
- I want then to get the max of the resulting numbers in the 2nd one but

how can I specify I want the max of the subset of data and not the max of
the full data enclosed in the column (i.e. when no filter is not set on 1st
column) ?

Any help greatly appreciated.
Regards,
Jerome.