Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
qed qed is offline
external usenet poster
 
Posts: 1
Default Max Value within filtered range

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Max Value within filtered range

=subtotal(4,range)

which can be used in code as well

mymax = application.Subtotal(4,Range("B2:B100"))

--
Regards,
Tom Ogilvy

"qed" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Max Value within filtered range

I tried the subtotal method and I'm getting a #Value Error. What am I doing
wrong?

Jeff
"Tom Ogilvy" wrote in message
...
=subtotal(4,range)

which can be used in code as well

mymax = application.Subtotal(4,Range("B2:B100"))

--
Regards,
Tom Ogilvy

"qed" wrote in message
...
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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Max Value within filtered range

What's in B2:B100?

Any errors?



Buster wrote:

I tried the subtotal method and I'm getting a #Value Error. What am I doing
wrong?

Jeff
"Tom Ogilvy" wrote in message
...
=subtotal(4,range)

which can be used in code as well

mymax = application.Subtotal(4,Range("B2:B100"))

--
Regards,
Tom Ogilvy

"qed" wrote in message
...
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




--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Max Value within filtered range

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)

--
Regards,
Tom Ogilvy

"Buster" wrote in message
...
I tried the subtotal method and I'm getting a #Value Error. What am I

doing
wrong?

Jeff
"Tom Ogilvy" wrote in message
...
=subtotal(4,range)

which can be used in code as well

mymax = application.Subtotal(4,Range("B2:B100"))

--
Regards,
Tom Ogilvy

"qed" wrote in message
...
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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using countif in a filtered range Mr E Excel Worksheet Functions 12 December 9th 09 09:19 PM
Sum a filtered range Peter Excel Discussion (Misc queries) 2 April 30th 09 07:57 AM
copy only filtered range. Miri Excel Discussion (Misc queries) 1 August 19th 07 01:41 PM
traversing through a filtered range based on another filtered range zestpt[_4_] Excel Programming 4 July 12th 04 06:37 PM
filtered range MarkJ Excel Programming 7 June 26th 04 10:49 PM


All times are GMT +1. The time now is 06:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"