+ Reply to Thread
Results 1 to 8 of 8

Using VBA to automate copy/paste on new Sheet

  1. #1
    Registered User
    Join Date
    12-17-2015
    Location
    Pennsylvania
    MS-Off Ver
    MS Office 365
    Posts
    85

    Using VBA to automate copy/paste on new Sheet

    I have a workbook that includes multiple sheets, unfortunately, the names and number of sheets vary from workbook to workbook. I am trying to set up a macro that:

    -selects active sheets
    -copies a specific range of cells
    -paste that information to a New sheet
    -selects next active sheet
    -copies text
    -paste into the same New sheet
    -repeat until all sheets have been copied/pasted into one new sheet for easy filtering

    I have the code to copy/paste, but I'm struggling on how to find active sheets and pasting to a new sheet after each copy/paste.

    Thanks in Advance for the help

    Thanks for looking and helping
    Last edited by mdolinger; 12-12-2016 at 12:55 PM. Reason: kev_ is the man, solved it for me!

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Using VBA to automate copy/paste on new Sheet

    We need a bit more information:

    Are you wanting one summary sheet per workbook?
    Are you wanting to copy all rows below the headings from each sheet?
    Is it all columns in each sheet?
    Do the ranges vary with time
    etc

    Perhaps you could attach an example workbook, with each sheet included, plus the resultant summary sheet

    thanks

  3. #3
    Registered User
    Join Date
    12-17-2015
    Location
    Pennsylvania
    MS-Off Ver
    MS Office 365
    Posts
    85

    Re: Using VBA to automate copy/paste on new Sheet

    @kev_ thank you for the quick response.

    I want one new summary page made from the each individual copy/paste, I don't need any headers and the range to be copied is constant on every sheet within the workbook, but the individual sheets will be different for every workbook.

    Attached is the workbook I'm using. You'll notice there is a button named "Gail". That is used to copy/paste info since we have to take info and dump it into another program.

    I'd like to be able to have one button on the index page that does that same copy/paste on each individual sheet into a new worksheet named "Gail"

    The names of each of the sheets will change based on each job and there might be one sheet or 20. This is where I'm lost
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Using VBA to automate copy/paste on new Sheet

    I have had a look at your workbook.

    1. Please confirm that
    - all hidden sheets should be excluded from the macro
    - Sheet named "Index" is to be excluded from the macro
    - all other sheets should be included in the macro

    2. Where have you hidden button "Gail"?
    (and I did not find any code for a button click event anywhere in the VBA)

    3. What is the specific range you want copying from each remaining sheet?

    4. When pasting into worksheet "Gail" the data will paste in sheet order

    5. In worksheet "Gail", the rows from one sheet will follow on immediately from the previous sheet

    6. Do you want a sheet identifier against each entries on Sheet "Gail"
    - for example ColumnA could include the sheet name

    7 Are you wanting the values copy/pasted
    OR
    do you want sheet Gail to contain formula?
    (so that change a in value in a subsidiary sheet is reflected in sheet Gail

    8 Is running the macro a once only event per workbook?
    OR
    is it a regular (eg monthly) task

    9 Do the headings in "Gail" mirror those in copied sheets?

  5. #5
    Registered User
    Join Date
    12-17-2015
    Location
    Pennsylvania
    MS-Off Ver
    MS Office 365
    Posts
    85

    Re: Using VBA to automate copy/paste on new Sheet

    @kev_
    All hidden sheets would be excluded as well as the index page, but the sheets will almost always have different names than what you're seeing in the template
    The Gail button is close to cell S80, it should be tied to ProContractor macro in the sheet, that macro has the range of what I will be copying/pasting
    pasting in sheet order is perfect and will follow immediately after each other.
    We don't need any Identifiers, as once all this is pasted into "Gail", that content then gets pasted into different program
    I only need values pasted into Gails Sheet
    The macro would typically be run once, but there are cases where we may have to rerun the macro if we change our estimate
    The headings in Gail would mirror those copied. The headings are in cells S81:AC81

    Thank you for going over this and helping me!

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Using VBA to automate copy/paste on new Sheet

    Does this summarise everything correctly:

    - copy Range("AR3:BB28") from each sheet in turn
    - paste values to sheet "Gail"
    - "Gail" headings are in Row1 and the data starts in A2
    - remove any rows where Units = 0 (in "Gail")
    - put all text into uppercase (in "Gail")

    Where (in relation to other sheets) should "Gail" be placed?
    Last edited by kev_; 12-09-2016 at 06:33 PM.

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Using VBA to automate copy/paste on new Sheet

    Put this vba in a module and give it a try.
    Notes make it largely self explanatory. Please ask if anything is not clear.

    The condition to delete rows where units =0 means that there are rows with values in other columns being deleted. It is consistent with ProContractor macro, but is it what you want?


    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-17-2015
    Location
    Pennsylvania
    MS-Off Ver
    MS Office 365
    Posts
    85

    Re: Using VBA to automate copy/paste on new Sheet

    @kev_ I just tried it quickly with a test sheet and it looks great! I will try it in a couple sheets today and see how it works. Thank you so much for your help!

+ 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. Automate repititive copy and paste
    By Raury in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2014, 12:53 PM
  2. Replies: 4
    Last Post: 08-12-2013, 01:35 PM
  3. How to automate copy paste
    By alyasch in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2013, 09:36 AM
  4. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  5. Automate copy and paste and copy and paste back to excel
    By Bmw318be in forum Access Tables & Databases
    Replies: 0
    Last Post: 02-23-2013, 05:42 AM
  6. Automate a Large Copy and Paste Task
    By The Cardinal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2009, 03:57 AM
  7. [SOLVED] Automate Cut/Copy/Paste from Excel Cells
    By Do it the Easy Way in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2006, 12:20 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