+ Reply to Thread
Results 1 to 7 of 7

copying worksheet in same workbook

  1. #1
    Forum Contributor
    Join Date
    01-13-2006
    Location
    Texas
    Posts
    161

    copying worksheet in same workbook

    hello all,

    I've searched the previous forum posts and the only reference I see to this seemingly simple problem uses exactly the approach that I cannot get to work.

    I have a workbook with 2 worksheets. On sheet 1 (Roster) is a list of names; on sheet 2 (Summaries) is a set of calculations.

    I want to create multiple copies of sheet 2 (Summaries) and name them according to the list of names on sheet 1 (Roster).

    Creating and naming the worksheets appears to be working fine. The problem is that the worksheets that are added are blank, not copies of worksheet 2.

    My code follows. Thanks in advance for pointing out my mistake.

    Conor

    Please Login or Register  to view this content.
    Last edited by Conor; 12-01-2008 at 10:57 AM.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387
    Conor,

    This modification to your code works for me.

    Please Login or Register  to view this content.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Contributor
    Join Date
    01-13-2006
    Location
    Texas
    Posts
    161
    Thanks for the reply, but it did not work for me. The edits you offered were very minor, and I don't get the point.

    But I have the code written in a module, not the worksheet, and it is assigned to a button_click event. Does that make any difference?

    Thanks again for the effort.

    Conor

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387
    Connor,

    The code should go in the worksheet where the "CommandButton" is located (probably sheet "Roster").


    Right click the sheet tab you want the code in, and click on View Code. Paste the code there.

    Please Login or Register  to view this content.

    You may want to consider attaching a copy of your workbook - see "Manage Attachments".

    Have a great day,
    Stan

  5. #5
    Forum Contributor
    Join Date
    01-13-2006
    Location
    Texas
    Posts
    161
    Thanks for your suggestions. Still no luck. I have attached the workbook. You will see that it is really simple. I'm baffled. I will appreciate any further help.

    Conor
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387
    Conor,

    The following code works for me with your posted workbook.

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Replace your original code, in worksheet "Roster", with the below code.

    Please Login or Register  to view this content.

    Have a great day,
    Stan

  7. #7
    Forum Contributor
    Join Date
    01-13-2006
    Location
    Texas
    Posts
    161
    Stan, thanks for hanging with me on this. Your last reply does the job exactly.

    Let me see if I can mark this solved and also give you your new reputation points.

    I appreciate the help.

    Conor

+ 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