hi
i need solve this code doesn't work no showing any data in sheet(account) from sheet(data) in sheet account i have to choose client in b1 by dropdown and write from date in b2 and b3 to date then run macro show the data in sheet (aacount)
this is my code
Code
Sub sama1()
Dim LastR As Long
Dim SText As String
Dim StDate As Date
Dim EndDate As Date
Dim LastR1 As Long
Application.ScreenUpdating = False
Sheets("account").Range("A5:h10000").ClearContents
SText = Sheets("account").Range("B1")
StDate = Sheets("account").Range("B2")
EndDate = Sheets("account").Range("B3")
LastR1 = Sheets("DATA").Cells(Rows.Count, 2).End(xlUp).Row
Sheets("DATA").Range("A3:g" & LastR1).AutoFilter Field:=7, Criteria1:=SText
Sheets("DATA").Range("A3:g" & LastR1).AutoFilter Field:=2, Criteria1:=">=" & Format(StDate, "mm/dd/yy"), Operator:=xlAnd, _
Criteria2:="<=" & Format(EndDate, "mm/dd/yy")
LastR = Sheets("DATA").Cells(Rows.Count, 2).End(xlUp).Row
Sheets("DATA").Range("A3:g" & LastR).SpecialCells(xlCellTypeVisible).Copy
Sheets("account").Range("A5").PasteSpecial
Sheets("account").Range("A5").Select
Sheets("DATA").Range("A3:g3").AutoFilter
Application.ScreenUpdating = True
End Sub
Display More