+ Reply to Thread
Results 1 to 6 of 6

Copy cells from last rows to another tab

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-28-2004
    MS-Off Ver
    Home/Office 2016
    Posts
    259

    Copy cells from last rows to another tab

    I need to copy the tab Name AND the A & B cells from the last row that has data - to the RESULTS tab
    Example:
    On the AL tab - copy A160 & B160 to the RESULTS tab then
    on the AR tab - copy A32 & B32 to the RESULTS tab under the AL tab data...etc...

    RESULTS
    AL (A160 data) (B160 data)
    AR (A32 data) (B32 data)

    {see attached}
    Attached Files Attached Files
    Last edited by x65140; 12-18-2014 at 10:38 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Copy cells from last rows to another tab

    Please update your profile as necessary to properly reflect the exact version(s) of Excel your question relates to. Members tailor answers based on your Excel version.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy cells from last rows to another tab

    Try the attached.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Copy cells from last rows to another tab

    Here's my version
    Sub YasserKhalil()
        Dim ws As Worksheet, LR As Long, I As Long
        I = 2
            For Each ws In ActiveWorkbook.Sheets
                If ws.Name <> "Results" Then
                    LR = ws.Range("A" & Rows.Count).End(xlUp).Row
                    Cells(I, 1).Value = ws.Cells(LR, 3).Value
                    Cells(I, 2).Value = ws.Cells(LR, 1).Value
                    Cells(I, 3).Value = ws.Cells(LR, 2).Value
                End If
                I = I + 1
                If I > Sheets.Count Then Exit Sub
            Next ws
    End Sub

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy cells from last rows to another tab

    FWIW:

    Sub x65140z()
    Dim i As Long
    Dim y As Long
    For i = 1 To Sheets.Count
        If Sheets(i).Name <> "RESULTS" Then
            With Sheets(i)
                y = .Range("A" & Rows.Count).End(3).Row
                .Range(.Cells(y, "A"), .Cells(y, "B")).Copy Sheets("RESULTS").Range("B" & Rows.Count).End(3)(2)
                Sheets("RESULTS").Range("A" & Rows.Count).End(3)(2) = Sheets(i).Name
            End With
        End If
    Next i
    End Sub

  6. #6
    Forum Contributor
    Join Date
    06-28-2004
    MS-Off Ver
    Home/Office 2016
    Posts
    259

    Re: Copy cells from last rows to another tab

    Thanks guys!!! Awesome....as usual!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA Split Cell Contents to New Rows & Copy Cells containing single values to the new rows
    By jaimelwilson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-14-2017, 05:30 PM
  2. [SOLVED] Identify duplicate rows and copy/Paste the first cell to all cells of equal rows
    By vs5 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-15-2014, 06:31 AM
  3. [SOLVED] Insert rows based on the current cell value and, then, copy some cells into the new rows
    By Excel-RZ in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-03-2013, 05:19 PM
  4. Replies: 0
    Last Post: 06-06-2013, 02:03 AM

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