+ Reply to Thread
Results 1 to 15 of 15

copying and pasting tabs macro

  1. #1
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    copying and pasting tabs macro

    Hi there.

    I need a macro that can cut and paste data (tabs) from one spreadsheet and paste it in another blank spreadsheet. Then go to another spreadsheet copy some data from there and paste it again in the blank worksheet and so on.

    Can anyone help with this please?

    Length of data may vary. Lots of spreadsheets and data so record may not be best option.

  2. #2
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    think it might be a move sheet type of command, but I don't know how that exactly works especially putting into a new blank work book, and then moving to another sheet after to copy and paste in. Please help

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copying and pasting tabs macro

    You seem to be confused about worksheets & workbooks

    Please Login or Register  to view this content.
    Last edited by royUK; 09-01-2010 at 06:32 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    Thanks.

    But what I need to do is a bit more complex than that.

    This is the process.

    I open up a spreadsheet, I need to copy data from a tab that is labelled "Area1". I need to move or copy and paste (values, formats) into new spreadsheet for Area 1. I then need to go to the data sheet again and find the tab "area 2" then copy paste and put into a new spreadsheet named "area2" and so on for 56 areas.

    I then need to go to another data sheet and do the same process and there are 20 different data sheets that need to be copied and pasted into these new spreadsheets

    Anyone have any ideas please?

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copying and pasting tabs macro

    Your explanation is still confusing, are you copying whole sheets or just part of each sheet?

  6. #6
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    Hi sorry for the confusion.

    It would be all the data in the sheet, then that data pasted values and formats (get rid of formulas)

    So just as 1 example.

    I go to the data spreadsheet "machines"

    I go to tab, "area1", I copy and paste all the data, everything and paste values and formats into a new spreadsheet named "area1".

    I then go back into the data spreadsheet do the same for "area2" until I get to no 56.

    I then go to the next data spreadsheet "expenditure", I do the same as above etc for 20 different sheets.

    I'm not sure if its possible to do a macro for all of this in one.

    Or whether you need a macro to do the job for each data spreadsheet.

    Need them in a certain order as well

  7. #7
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    Please Login or Register  to view this content.
    Last edited by floricita; 08-10-2010 at 07:57 AM.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: copying and pasting tabs macro

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

  9. #9
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    Hmm that didn't work at all!!

  10. #10
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    Hi again

    When I run this I get the error

    "Run time error 1004
    You typed an invalid name for a sheet or chart. Make sure that

    The name that you type does not exceed 31 chracters
    The name does not contain any of the following character : \/?
    or [or]
    You did not leave the name blank"

    The part of the code it highlights is

    ActiveSheet.Name = Left(myTempWorkbook.Name, InStrRev(myTempWorkbook.Name, ".") - 1)

    Have you any idea how I can fix this please?

    Thank you

  11. #11
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    I also want it to copy everything that is inputted into the spreadsheets. How do I incorporate this into the code also??

    I'm also not sure how it selects the order of the spreadsheets? I need them to follow a specific order, so knowing the mechanic as to how to change this would be great also.

    Thanks again
    Last edited by floricita; 09-01-2010 at 06:38 AM. Reason: additional info

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: copying and pasting tabs macro

    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    Thanks.
    I will give that a go

  14. #14
    Forum Contributor
    Join Date
    05-24-2010
    Location
    London England
    MS-Off Ver
    Excel 2003
    Posts
    345

    Re: copying and pasting tabs macro

    Ok, I copied that in over the part which has copy in and it didn't work.

    Error said sh not defined


  15. #15
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: copying and pasting tabs macro

    Remove 'option Explicit'

+ Reply to Thread

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