+ Reply to Thread
Results 1 to 2 of 2

Copy Data from Multiple sheets to single using macro / each sheet to be copies on next row

Hybrid View

  1. #1
    Registered User
    Join Date
    02-08-2013
    Location
    toronto, ON
    MS-Off Ver
    Excel 2010
    Posts
    10

    Copy Data from Multiple sheets to single using macro / each sheet to be copies on next row

    I have a workbook with 6 sheets and one master sheet. I am trying to use macro to update master sheet by copying from 6 sheets but when it copies from sheet 2 it always take the destination cell as fixed while I want it to paste it into next available row since data will be increasing over the time. Macro is below and you can see the range is fixed cell reference. Pls help.

    Thanks

    '
    ' Macro1 Macro
    '

    '

    Application.Goto Reference:="Table5"
    Selection.Copy
    Sheets("Master Report").Select
    Selection.End(xlToLeft).Select
    Selection.End(xlUp).Select
    Range("A8").Select
    ActiveSheet.Paste
    Selection.End(xlDown).Select
    Range("A152").Select
    Application.Goto Reference:="Table1"
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master Report").Select
    ActiveSheet.Paste
    Selection.End(xlDown).Select
    Range("A332").Select
    Application.Goto Reference:="Table2"
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master Report").Select
    Range("A326").Select
    Selection.End(xlDown).Select
    Range("A332").Select
    ActiveSheet.Paste
    Selection.End(xlDown).Select
    Range("A392").Select
    Application.Goto Reference:="Table3"
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master Report").Select
    ActiveSheet.Paste
    Selection.End(xlDown).Select
    Range("A932").Select
    Application.Goto Reference:="Table4"
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master Report").Select
    ActiveSheet.Paste
    Selection.End(xlDown).Select
    Range("A1856").Select
    Application.Goto Reference:="Table6"
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master Report").Select
    ActiveSheet.Paste
    Range("A1857").Select
    Selection.End(xlDown).Select
    Range("A4").Select
    End Sub

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Copy Data from Multiple sheets to single using macro / each sheet to be copies on next

    Its hard to get it right since this is a recorded macro.

    See if this helps

    Option Explicit
    
    Sub copyData()
    
    Dim ws As Worksheet
    Dim lcol As Long
    Dim lrow As Long
    Dim lrowr As Long
    
    For Each ws In ThisWorkbook.Sheets
    
        If Not ws.Name = "Master Report" Then
        
            lcol = ws.Cells(1, Columns.Count).End(xlToLeft).Column
            lrow = ws.Cells(Rows.Count, 1).End(xlUp).Row
            lrowr = Sheets("Master Report").Cells(Rows.Count, 1).End(xlUp).Row
            
            ws.Cells(2, 1).Resize(lrow, lcol).Copy Destination:= _
            Sheets("Master Report").Cells(lrowr + 1, 1)
        End If
        
    Next
    
    End Sub
    Thanks

    Ps: use code tags around your code ( the # button)

+ Reply to Thread

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