Results 1 to 11 of 11

Autofilter for Unique values - changes paste location issue

Threaded View

bk77 Autofilter for Unique values... 06-24-2011, 05:33 PM
jaslake Re: Autofilter for Unique... 06-24-2011, 07:47 PM
bk77 Re: Autofilter for Unique... 06-27-2011, 11:43 AM
jaslake Re: Autofilter for Unique... 06-27-2011, 11:54 AM
bk77 Re: Autofilter for Unique... 06-27-2011, 12:33 PM
jaslake Re: Autofilter for Unique... 06-27-2011, 01:23 PM
bk77 Re: Autofilter for Unique... 06-27-2011, 01:58 PM
jaslake Re: Autofilter for Unique... 06-27-2011, 02:04 PM
jaslake Re: Autofilter for Unique... 06-27-2011, 02:11 PM
bk77 Re: Autofilter for Unique... 06-27-2011, 03:43 PM
jaslake Re: Autofilter for Unique... 06-27-2011, 03:47 PM
  1. #1
    Registered User
    Join Date
    03-25-2009
    Location
    Minneapolis, MN
    MS-Off Ver
    Excel 2010
    Posts
    12

    Autofilter for Unique values - changes paste location issue

    I would like to start by saying i am pretty much a novice on this stuff so the coding is pretty clunky.

    I have a workbook with multiple tabs. Each worksheet can have 2 or many rows and 1 or many values in the invoice number field. In each worksheet, I need to document each invoice number and the amount to be paid. I have the below 2 macros that can do the job but I haven't been able to figure out how to make the paste location dependent on the location of the last populated row.

    Thanks in advance.

    
    Sub GettingInvoiceNos1()
    '
    ' GettingInvoiceNos1 Macro
    
    
    Dim Wks As Worksheet
    
    For Each Wks In ActiveWorkbook.Worksheets
    With Wks
    Select Case LCase(.Name)
    Case Is = "Invoice"
    'do nothing
    Case Else
    'in case you just used the activesheet in your existing code
    .Select
    Call GettingInvoiceNos2
    End Select
    End With
    Next Wks
    
    End Sub
    
    
    Sub GettingInvoiceNos2()
    '
    ' GettingInvoiceNos2 Macro
    '
    
    '
    Dim LastRow As Long
    LastRow = Cells(Rows.Count, "af").End(xlUp).Row
        Columns("AF:AF").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
            "AF290"), Unique:=True
        Range("AF1").Select
        Selection.End(xlDown).Select
        Selection.End(xlDown).Select
        Range("AG291").Select
        ActiveCell.FormulaR1C1 = "=SUMIF(R2C[-1]:R[-4]C[-1],RC[-1],R2C[3]:R[-4]C[3])"
        Selection.NumberFormat = "$#,##0.00"
        Selection.AutoFill Destination:=Range("AG291:AG293")
        Range("AG291:AG293").Select
        Range("AG293").Select
        Selection.End(xlDown).Select
        Selection.End(xlUp).Select
        Range("AG295").Select
        ActiveCell.FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"
        Range("AG296").Select
        ActiveWindow.SmallScroll Down:=-12
    End Sub
    Last edited by bk77; 06-27-2011 at 03:43 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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