LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default variant criteria name to filter

morning all.
I received a filter macro from here last October, 2008. Over the past 11
months or so, I've been modifying it as needed to meet various needs, and up
until now, all of my mod's have worked great.
I know I posted on this previously, but it was never answered due to my not
understanding what I was trying to explain.
The filter tool in excel looks for a specific statement based on the
criteria selected.
For my need, there are times when I want to look at a name that's LIKE the
criteria-- but not necessary the same, EXACTLY spelled name. Say, there are
names that are missing periods, for middle initials, or the date in one use
is configured mm/dd/yy, and another is mm/dd/yyyy, or Month-Day-Year, or
have an ampersand instead of and, etc.....
Presently, my filter ignores those-- as it should, I suppose-- and if it
can't find the exact match, there is no match.

My code is:

Sub FilterA()

Dim wks As Worksheet

mv = Range("f2").End(xlDown).value
' this sets the criteria for the ChgAppl#.

mv1 = Range("a2").End(xlDown).value
'this is my add-on to set a second criteria filter- Name of owner.

For Each wks In ActiveWorkbook.Worksheets

If LCase(Left(wks.Name, 3)) Like "sum" Then

With wks
Sheets(wks.Name).Range("A8:F8").AutoFilter field:=1, Criteria1:=mv
'this takes in to acct the chg appl# for a filter.


Sheets(wks.Name).Range("A8:F8").AutoFilter field:=3,
Criteria1:=mv1
'this takes in to account the owner name for a filter.
End With

End If

Next wks
End Sub

My goal would be to do something like--
if mv1 like field then
...........
end if

I've tried a few ideas I had, and none of them worked. And it's been several
weeks since I tried them, so I can't remember specifics at this point.

Thank you for your helps.
Best.
 
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
Filter with criteria! ernietan Excel Discussion (Misc queries) 1 April 15th 10 09:40 AM
Using created variant value to reference to a variant within my code TD[_3_] Excel Programming 1 April 22nd 09 11:53 AM
variant sheet name to filter SteveDB1 Excel Programming 6 October 16th 08 12:05 AM
Filter Criteria Yaasien Excel Discussion (Misc queries) 3 May 26th 05 02:43 PM
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du TC Excel Worksheet Functions 1 May 12th 05 02:06 AM


All times are GMT +1. The time now is 11:44 PM.

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

About Us

"It's about Microsoft Excel"