View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Executor Executor is offline
external usenet poster
 
Posts: 74
Default Filtering and user input

Hi Lvanom,

You are close:

'Get the filter's criteria from the user
FilterCriteria = InputBox("Enter Scheduled Downday.(MM/DD/YY)")
'Filter the data based on the user's input
Selection.AutoFilter Field:=12, Criteria1:="<" & FilterCriteria

HTH,

Executor


Lvenom wrote:
I have a macros to filter data based on user input that works just fine.
My problem is when the user input is supposed to be the data excluded
from the filter my macro doesn't seem to filter out the undesired data.
(Data is date related with one filter asking to see data from a specific
date and the other fliter asking not to see data from a specific date.
My code is below...can anyone see my mistake? Thank you in advance for
your help

To include specific date:
'Get the filter's criteria from the user
FilterCriteria = InputBox("Enter Scheduled Downday.(MM/DD/YY)")
'Filter the data based on the user's input
Selection.AutoFilter Field:=12, Criteria1:=FilterCriteria

To exclude specific date
'Get the filter's criteria from the user
FilterCriteria = InputBox("Enter Scheduled Downday.(MM/DD/YY)")
'Filter the data based on the user's input
Selection.AutoFilter Field:=12, Criteria1:="<FilterCriteria"


--
Lvenom
------------------------------------------------------------------------
Lvenom's Profile: http://www.excelforum.com/member.php...o&userid=35358
View this thread: http://www.excelforum.com/showthread...hreadid=553366