Results 1 to 2 of 2

Looping through Worksheets, Copy/Paste Each Sheet during Loop

Threaded View

  1. #1
    Registered User
    Join Date
    06-30-2012
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    11

    Looping through Worksheets, Copy/Paste Each Sheet during Loop

    I posted about this same issue once before but was unable to find a solution.

    I'm working on a macro that requires the ability to loop through the worksheets of one workbook and paste each sheet as it's own sheet to the end of another workbook.

    So one workbook is a master data file. It contains about a 10 quarters of market data. In the other workbook, which is a comparison file, I need to be able to pull from the master data file, however many number of quarters of data that a user requests.

    I've seen several pieces of code that will loop through an entire workbook and paste each sheet into another workbook. This is similar to what I need, but it won't satisfy what I need the macro to do.

    In this macro, a user defines how many quarters of data should be pulled from the masterfile into the comparison file. I've done this through an input box and I set the result of the user's input as a variable. The loop should only pull the requested amount of data from one workbook to the next. So for instance, if a user wants 4 quarters of data it would only pull the last 4 quarters into the comparison file. If the user decides he/she only wants one quarter of data, then the macro would only pull the first data sheet into the comparison file and so on.

    I've attached the two documents, and the macro that I'm working on is called "Orange" (silly name, I know). If someone could go through the code I have and help me with this, it would be great. Thanks for taking the time to read!
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

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