abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,429
- Office Version
- 2019
- 2010
- Platform
- Windows
hello
i'm asking about filter data based on two names on the same filtered column in column 3 (c) for instance if i write in e3 and f3 the names based on sheet1 in colm 3 is it possible do that ? if is possible i hope somebody help i try amending but it gives me error
thanks
i'm asking about filter data based on two names on the same filtered column in column 3 (c) for instance if i write in e3 and f3 the names based on sheet1 in colm 3 is it possible do that ? if is possible i hope somebody help i try amending but it gives me error
VBA Code:
Sub Test1()
Dim CID As String: CID = sheet2.[e3].Value
Dim CID1 As String: CID1 = sheet2.[f3].Value
Dim FromDt As Long: FromDt = sheet2.[d3].Value
Dim ToDt As Long: ToDt = sheet2.[c3].Value
Application.ScreenUpdating = False
sheet2.[A5].CurrentRegion.Offset(1).Clear
With sheet1.[A2].CurrentRegion
.AutoFilter 3, CID, CID1
.AutoFilter 2, ">=" & FromDt, xlAnd, "<=" & ToDt
.Offset(1).EntireRow.Copy sheet2.Range("A" & Rows.Count).End(3)(2)
.AutoFilter
End With
Application.ScreenUpdating = True
End Sub