+ Reply to Thread
Results 1 to 5 of 5

VBA - Copy data ranges from multiple worksheets and sequentially paste into a summary tab

  1. #1
    Registered User
    Join Date
    07-13-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2010
    Posts
    2

    VBA - Copy data ranges from multiple worksheets and sequentially paste into a summary tab

    Hi All,
    I am new on VBA and all I'm trying to do is copying ranges of data from multiple sheets and paste them sequentially into a summary sheet within a single workbook
    The code seems to work well, but it is also importing additional and unnecessary data from the worksheets. The ranges may vary each time the data is extracted.
    Code used:

    Sheets("Summary").Activate

    For Each ws In Worksheets
    If ws.Name = "ME5A_List" Then
    ws.Range("T2:T65000").Copy
    ActiveSheet.Paste Range("A2").End(xlUp).Offset(1, 0)
    ws.Range("B2:C65000").Copy
    ActiveSheet.Paste Range("E2").End(xlUp).Offset(1, 0)
    ws.Range("G2:H65000").Copy
    ActiveSheet.Paste Range("G2").End(xlUp).Offset(1, 0)
    ws.Range("D2:D65000").Copy
    ActiveSheet.Paste Range("S2").End(xlUp).Offset(1, 0)
    ws.Range("I2:J65000").Copy
    ActiveSheet.Paste Range("J2").End(xlUp).Offset(1, 0)
    End If
    Next ws

    For Each ws In Worksheets
    If ws.Name = "CC Data" Then
    ws.Range("Q2:Q65000").Copy
    ActiveSheet.Range("A65536").End(xlUp).Offset(1, 1).Select
    ActiveSheet.Paste
    ws.Range("Q2:Q65000").Copy
    ActiveSheet.Range("A65536").End(xlUp).Offset(1, 1).Select
    ActiveSheet.Paste
    ws.Range("B2:C65000").Copy
    ActiveSheet.Range("A65536").End(xlUp).Offset(1, 4).Select
    ActiveSheet.Paste
    ws.Range("G2:H65000").Copy
    ActiveSheet.Range("A65536").End(xlUp).Offset(1, 6).Select
    ActiveSheet.Paste
    ws.Range("I2:J65000").Copy
    ActiveSheet.Range("A65536").End(xlUp).Offset(1, 9).Select
    ActiveSheet.Paste
    ws.Range("D2:D65000").Copy
    ActiveSheet.Range("A65536").End(xlUp).Offset(1, 18).Select
    ActiveSheet.Paste

    End If
    Next ws

    For Each ws In Worksheets
    If ws.Name = "IWBK_Data" Then
    ws.Range("A2:A65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 1).Select
    ActiveSheet.Paste
    ws.Range("O2:O65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 2).Select
    ActiveSheet.Paste
    ws.Range("H2:I65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 8).Select
    ActiveSheet.Paste
    ws.Range("J2:L65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 11).Select
    ActiveSheet.Paste
    ws.Range("N2:N65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 15).Select
    ActiveSheet.Paste
    ws.Range("T2:T65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 16).Select
    ActiveSheet.Paste
    ws.Range("W2:W65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 10).Select
    ActiveSheet.Paste
    ws.Range("AB2:AE65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 3).Select
    ActiveSheet.Paste
    ws.Range("W2:X65000").Copy
    ActiveSheet.Range("B65536").End(xlUp).Offset(1, 10).Select
    ActiveSheet.Paste
    End If
    Next ws
    Application.ScreenUpdating = True

  2. #2
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: VBA - Copy data ranges from multiple worksheets and sequentially paste into a summary

    Please use code tags to post your code.. moreover share a sample input sheet + output sheet for more clarifications if you can...


    Please update your post
    Please Login or Register  to view this content.
    Regards
    Parth

    I appreciate your feedback. Hit * if u Like.
    Rules - http://www.excelforum.com/forum-rule...rum-rules.html

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

    Re: VBA - Copy data ranges from multiple worksheets and sequentially paste into a summary

    Ditto Post#2.

    Does this help?

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-13-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2010
    Posts
    2

    Re: VBA - Copy data ranges from multiple worksheets and sequentially paste into a summary

    Hi John,
    This is brilliant. Works perfectly.
    Cheers

  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: VBA - Copy data ranges from multiple worksheets and sequentially paste into a summary

    Glad to hear that.

+ 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. Copy & Paste Row 3 from multiple worksheets to summary sheet if cell A3 equals a date
    By Volunteer2 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-02-2015, 12:04 PM
  2. [SOLVED] copy data from multiple worksheets and paste into summary sheet
    By forquaidian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2014, 08:27 AM
  3. [SOLVED] Problem with macro to copy certain data from multiple worksheets into a summary worksheet
    By niftysquirrel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-14-2013, 03:35 PM
  4. Copy and paste the most recent entered data from other worksheets to summary sheet
    By cvsrini in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-18-2013, 04:51 AM
  5. Copy ranges from multiple worksheets in excel and then paste special in Powerpoint
    By mclarke2030 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-25-2013, 04:47 PM
  6. [SOLVED] Copy multiple worksheets data & paste into blank columns in summary worksheet
    By guest99999 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-21-2013, 09:56 AM
  7. Search multiple worksheets, copy and paste into "Summary" sheet
    By meowzers in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2010, 05:06 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