Results 1 to 6 of 6

Add snipped to paste report in descending order

Threaded View

  1. #1
    Registered User
    Join Date
    10-14-2017
    Location
    Miami, Florida
    MS-Off Ver
    2016
    Posts
    83

    Add snipped to paste report in descending order

    Hi,

    I have a code that extract matched rows and copy to another sheet, But it copy on next empty rows But is copying on Ascending Order (bottom of last records).

    I would like to make the change the copy/paste in descending order ( on top of last records)

    The snniped that i need to add in the code is
     Range.Sort Key1:=Range("A2"), Order1:=xlDescending
    This is the original threat:
    https://www.excelforum.com/excel-pro...e-matches.html

    and this is the original code
     Sub Treat()
    Dim RefRg As Range, R As Range
    Dim WkRg As Range, W As Range
    Dim HRg  As Range
    Dim DataRg As Range
    Const WS1Name As String = "Sheet1"
    Const WS2Name As String = "Test"
    
        Set RefRg = Sheets(WS1Name).Range("I14:M14")
        Set HRg = Sheets(WS1Name).Range("D2:P2")
        Set WkRg = Sheets(WS1Name).Range("D3:D12")
        For Each R In RefRg
            For Each W In WkRg
                If (R = W) Then
                    HRg.Copy Destination:=Sheets(WS2Name).Cells(Rows.Count, "B") '.End(3)(2)
                    W.Resize(1, HRg.Count).Copy Destination:=Sheets(WS2Name).Cells(Rows.Count, "B").End(3)(2)
                End If
            Next W
        Next R
        Application.CutCopyMode = False
        MsgBox ("Job Done")
    End Sub



    Thank you!!

    Andy

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel 2007 : Extract by descending order
    By Shilpa kanchan in forum Excel General
    Replies: 1
    Last Post: 12-25-2011, 03:53 AM
  2. Macro for arranging in descending order.
    By Taureankv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2010, 10:24 PM
  3. vlookup in descending order
    By thebigmancometh in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-01-2010, 09:41 AM
  4. vlookup in descending order
    By thebigmancometh in forum Excel General
    Replies: 1
    Last Post: 02-16-2010, 06:13 AM
  5. Line graph in descending order
    By jsmity in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-08-2009, 04:38 PM
  6. descending order using paste special
    By devesh.agrawal in forum Excel General
    Replies: 2
    Last Post: 05-08-2009, 12:46 AM
  7. Sort in descending order
    By shahcu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-28-2008, 03:01 AM
  8. autofill in descending order
    By suzzmenn in forum Excel General
    Replies: 1
    Last Post: 09-15-2007, 01:11 AM

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