+ Reply to Thread
Results 1 to 4 of 4

Selecting grouped worksheets

  1. #1
    Forum Contributor
    Join Date
    07-18-2012
    Location
    New York
    MS-Off Ver
    2016
    Posts
    193

    Selecting grouped worksheets

    Hello,

    I have a macro that will make a specific number of copies of the active sheet based on the number that is entered in a message box.


    Sub newtab()
    '
    ' newtab Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+W

    Dim x As Integer

    x = InputBox("Enter number of times to copy active sheet")
    For numtimes = 1 To x
    'Loop by using x as the index number to make x number copies.
    ActiveWorkbook.ActiveSheet.Copy _
    Before:=ActiveWorkbook.ActiveSheet
    'Put copies in front of activesheet.
    Next
    End Sub


    And another one that I Frankensteined together to put each copy in a separate workbook.

    Sub copytabnewbook()
    '
    ' copytabnewbook Macro
    '
    ' keyboard shortcut: CTRL+Shift+H

    On Error Resume Next
    Dim x As Integer

    x = InputBox("Enter number of times to copy active sheet")
    For numtimes = 1 To x
    'Loop by using x as the index number to make x number copies.
    ActiveWorkbook.ActiveSheet.Copy _

    Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    Range("A1").Select


    Next
    End Sub


    I have two questions about how I can change these to better serve my needs, the first is how can I change them so that they will copy multiple worksheets that I have grouped? The second question which is ultimately going to end up as a new macro is that with the second macro, instead of it creating each copy in an individual workbook, how can I change it to have all of the copies go to a single workbook?

    Thanks in advance,
    Tristan

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Selecting grouped worksheets

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    07-18-2012
    Location
    New York
    MS-Off Ver
    2016
    Posts
    193

    Re: Selecting grouped worksheets

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-18-2012
    Location
    New York
    MS-Off Ver
    2016
    Posts
    193

    Re: Selecting grouped worksheets

    Someone at my office was able to come up with this. Enjoy.


    Please Login or Register  to view this content.

+ 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. Grouped rows disabled when Protecting worksheets!
    By DaveRimmer in forum Excel General
    Replies: 9
    Last Post: 11-27-2013, 12:18 AM
  2. [SOLVED] Creating Grouped Worksheets
    By Janie in forum Excel General
    Replies: 2
    Last Post: 07-18-2013, 09:05 AM
  3. Selecting across worksheets
    By JMS in forum Excel General
    Replies: 1
    Last Post: 07-14-2005, 06:05 PM
  4. [SOLVED] Selecting WorkSheets
    By Jordan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-25-2005, 04:06 PM
  5. [SOLVED] protect/unprotect grouped worksheets
    By Todd in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2005, 12:45 PM

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