Excel VBA - Display Selection Criteria on Report

  • Thread starter Thread starter Jim Palmer
  • Start date Start date
J

Jim Palmer

I would like to display the data autofilter selection criteri
automatically someplace in a report.

For instance, advise the users that the report only contains entrie
where hours > 40, or where vendor contains smith.

Is anyone aware of how this could be done?

Sincerely

Jim Palme
 
Thanks, works great except when I use dates in the criteria it display
<37987 instead of <2004/01/01.

Is there a way to format the result for dates.

I tried using string functions, for example
=LEFT(FilterCriteria(H4),1)&
"&YEAR((VALUE(RIGHT(FilterCriteria(H4),5))))&"/"&MONTH((VALUE(RIGHT(FilterCriteria(H4),5))))&"/"&DAY(VALUE(RIGHT(FilterCriteria(H4),5))
and that works fine if I select dates less than or greater than
certain day, however it does not work for dates between two days
 
In a response to a private email, I wrote:

In my test workbook, it did return the date string:

=01/29/2004
(in my case).

But maybe you could try:
=TEXT(MID(filtercriteria(I7),2,255),"mm/dd/yyyy")
 
Thanks very much

You led me on the right track.

I filtered for dates greater than February 28th and less than Jul
1st.

H2 Contains the result of the FilterCriteria Function:
37680 AND <37803
I entered a formula in H3 that evaluated to:
Less Than Jul-01-03
Then I entered a formula in H4 that evaluated to:
Greater than Feb-28-03


The formula in H3 is
=IF(ISERR(FIND("<",H$2,1)),"","Less Tha
"&TEXT(VALUE(MID(H$2,FIND("<",H$2,1)+1,5)),"mmm-dd-yy"))

The result isn't displayed in one cell but I think it will be mor
informative to the end user.

Best regards

Jim Palme
 
Back
Top