Results 1 to 5 of 5

Adding a last row in a range adding the previous!

Threaded View

  1. #1
    Registered User
    Join Date
    06-15-2012
    Location
    Greece
    MS-Off Ver
    Excel 2007
    Posts
    85

    Adding a last row in a range adding the previous!

    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.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Next & Previous buttons not working when adding Last button
    By jlsewall in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2013, 09:41 AM
  2. Correct formula for adding columns based on previous row
    By packers316 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-02-2013, 06:44 AM
  3. Adding and subtracting to a cell's previous value
    By elimelim in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-09-2012, 02:52 PM
  4. Macro for adding rows after previous row?
    By xwishmasterx in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-17-2010, 07:28 PM
  5. Adding values from previous worksheets
    By firecord in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-06-2005, 12:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1