+ Reply to Thread
Results 1 to 12 of 12

Copy worksheet, paste, and rename

  1. #1
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Copy worksheet, paste, and rename

    I want to have a worksheet be copied, pasted immediately after that tab, and then all of the succeeding ones in that group renamed.
    I have worksheets that are labeled Section 1, Section 2, etc. up to 22 (but there could be more or less, it changes.) and then I have 4 worksheets after the Sections which I don't want renamed.

    I have attached a testbook that should help!
    Thanks in advance to anyone who helps me
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Copy worksheet, paste, and rename

    When I say renamed, I mean this. Lets say I want to put a sheet in between Section 2 and Section 3. I would want the new sheet to be named Section 3, Section 3 to be named section 4, and the sheets that aren't named Section X to remain the same.

  3. #3
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Copy worksheet, paste, and rename

    Does anyone have any ideas on this? I tried just recording a macro but it wouldn't apply to any case except that one.

  4. #4
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Copy worksheet, paste, and rename

    Is there anything else I need to supply for help?

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Which worksheet do you want to copy?
    If posting code please use code tags, see here.

  6. #6
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Copy worksheet, paste, and rename

    Basically what I want is to be able to paste a blank template that is used in the "Section" tabs. After that is placed wherever it has to end up, I want to rename all of the Sections so that their number corresponds to their placement in the Section section.
    For example, in my Testbook I have Sections 1, 2, and 3. If I were to copy that template from Section 2 and then paste the tab in between Sections 2 & 3, that new tab would be Section 3, and Section 3 would become Section 4.

  7. #7
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Copy worksheet, paste, and rename

    Is what I'm wanting to do not possible?

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy worksheet, paste, and rename

    You've not given enough information really.

    For example what do you mean by 'wherever it has to end up'?

    How are you determining where the worksheet ends up?

  9. #9
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Copy worksheet, paste, and rename

    These tabs may get rearranged based on the type of report that will be printed later, so I will need to rename the Sections to numerical order based on what order they are in before printing.

    I guess what I'm hoping for is potentially two separate macros. One that will insert a worksheet with the sections template, and another that can rename the Sections worksheets to numerical order. I'm not sure how the first one would look, but the second one could probably use a string compare for the worksheet name, right?

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copy worksheet, paste, and rename

    Sorry it's still not clear where you want to insert the new worksheet.

    At first I thought you wanted to insert it after all the other Section worksheets but then you seemed to want it to go between sheets among those sheets.

  11. #11
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Copy worksheet, paste, and rename

    Yes, just after the end of the Sections worksheets.

  12. #12
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Copy worksheet, paste, and rename

    Should I just do both of those macros separately?

+ 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