hello experts !
i have this file and the code it works the code works on sheet account when select from dropdown in b1, and choose the dates b2,b3 but i would mod the code I put the expected result in sheet "result "how the data should be see the values highlighted blue I have this formula
Range("e7:e" & lr).FormulaR1C1 = "=R[-1]C+RC[-7]-RC[-1]"
but I no know where i add it and should be bring the value highlighted red this always bring from sheet1 to sheet account in row 7 if the name contains balance in sheet 1
I hope to anybody help me
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")
If SText = "" Then SText = "*"
StDate = Sheets("account").Range("B2")
If StDate = 0 Then StDate = WorksheetFunction.Min(Sheets("DATA").Columns(2))
EndDate = Sheets("account").Range("B3")
If EndDate = 0 Then EndDate = WorksheetFunction.Max(Sheets("DATA").Columns(2))
LastR1 = Sheets("DATA").Cells(Rows.Count, 2).End(xlUp).Row
Sheets("DATA").Range("A3:g" & LastR1).AutoFilter Field:=6, 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