PDA

View Full Version : filter data Automatically with wildcard characters string



amartakale
09-06-2019, 12:51 AM
Hi experts,

Here I prepared filter sheet where data sort as per criteria selection with vba code.

Explanation:
If I select company name in D10 & Analyst Name in D11 then data sort as per criteria match. if both criteria match then data show otherwise no.

If company selected in D10 and analyst name select in D11 as blank then data will sort only that company. If Analyst Name selected in D11 and Company name select in D10 as blank then data will sort only that Analyst Name

Here I am facing issue in cell C27, C28, C31, C32 because of multiple companies in one cell, so I want VBA Code will modified as wildcard search. If I put only HDFC then all cell will be filter where HDFC text found in range in column C.

Can it possible?

Regards
Amar Takale

nikki333
09-06-2019, 01:27 AM
I've changed your worksheet_change sub from as follows:



Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
If Not Intersect(Target, Range("d10:d11")) Is Nothing Then
For i = 1 To 2
[d14:f14].AutoFilter i, Criteria1:="*" & Range("d" & i + 9) & "*"
Next i
End If
End Sub

amartakale
09-06-2019, 01:43 AM
Great!:yes

Thanks very much sir