amarokWPcom
New Member
- Joined
- May 30, 2019
- Messages
- 25
Hi,
I put a filter with AdvancedFilter.
For some search strings I get to manz results.
So f.e. for "John" I get also"Johnsson", "Johnson" etc., everzthing that fits to John*.
I know already by using the string ="=John" that I would get ONLY "John" like I want.
But my Subroutine has not a string as searchterm but a variable as you can see bellow.
How do I have to change the code bellow to make this work????
I put a filter with AdvancedFilter.
For some search strings I get to manz results.
So f.e. for "John" I get also"Johnsson", "Johnson" etc., everzthing that fits to John*.
I know already by using the string ="=John" that I would get ONLY "John" like I want.
But my Subroutine has not a string as searchterm but a variable as you can see bellow.
How do I have to change the code bellow to make this work????
HTML:
Sub DISTRIBUTIONLIST_SEARCH()
Dim WS_DIST_SOURCE As Worksheet
Dim WS_DIST_RESULTS As Worksheet
Set WS_DIST_RESULTS = ThisWorkbook.Worksheets("DISTRIBUTE_RESULT")
Set WS_DIST_SOURCE = ThisWorkbook.Worksheets("DISTRIBUTE_LIST")
WS_DIST_RESULTS.Range("A1").CurrentRegion.Offset(1).ClearContents
Dim rg4 As Range
Set rg4 = WS_DIST_SOURCE.Range("A1").CurrentRegion
Dim criteriaRange4 As Range
Set criteriaRange4 = ThisWorkbook.Worksheets("DISTRIBUTE_DISCRIPTION").Range("A2"). _
CurrentRegion
' THE MAIN Code
rg4.AdvancedFilter xlFilterCopy, criteriaRange4, WS_DIST_RESULTS.Range("A1:D1")
End Sub