S
Steve
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.
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.