Hi there.
I use this code for getting back in another sheet results according the dates distance and a a customer code.
What i need is when i get my results using the code, after the last used row to appear a word "Total" in column A and the sum of previous cells in column C.
Sub Macro1()
Dim rngFilter As Range
Dim sDate1 As Long, sDate2 As Long
Dim sID As String
With Worksheets("macro")
sDate1 = .Range("b1").Value
sDate2 = .Range("b2").Value
sID = .Range("c1").Value
End With
With Worksheets("data")
.Range("A1:c9").AutoFilter Field:=1, Criteria1:= _
">=" & sDate1, Operator:=xlBetween, Criteria2:="<=" & sDate2
.Range("A1:c9").AutoFilter Field:=2, Criteria1:=sID
Set rngFilter = .Range("a2").CurrentRegion.SpecialCells(xlCellTypeVisible)
.Range("$A$1").AutoFilter
End With
If Not rngFilter Is Nothing Then
With Worksheets("macro")
.Range("a6:c" & .Cells(6, "c").End(xlDown).Row).ClearContents
rngFilter.Copy .Range("a6")
End With
End If
End Sub
Any help on this is much appreciated.
Thanks in advance.
Bookmarks