Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: VBA: Copy different sheet in same workbook multiple times, naming according to list in cells

  1. #11
    Board Regular My Aswer Is This's Avatar
    Join Date
    Jul 2014
    Posts
    15,808
    Post Thanks / Like
    Mentioned
    28 Post(s)
    Tagged
    13 Thread(s)

    Default Re: VBA: Copy different sheet in same workbook multiple times, naming according to list in cells

    Try this to solve the hidden sheet issue:
    Code:
    Sub Copy_Master()
    'Modified  7/22/2019  7:33:00 AM  EDT
    On Error GoTo M
    Application.ScreenUpdating = False
    Dim i As Long
    Dim Lastrow As Long
    Lastrow = Sheets("Start").Cells(Rows.Count, "B").End(xlUp).Row
    Sheets("Master").Visible = True
    For i = 1 To Lastrow
        Sheets("Master").Copy After:=Sheets(Sheets.Count)
        ActiveSheet.Name = Sheets("Start").Cells(i, "B").Value
    Next
    Application.ScreenUpdating = True
    Sheets("Master").Visible = False
    Exit Sub
    M:
    MsgBox "That sheet name may already be used or you made some mistake"
    End Sub
    Be sure and always test this script on sample data the first time you use this as to avoid any problems with your data. Always trying to learn more and help others where I can. I'm using Excel 2013.
    Patience please Iím not perfect yet. "Memories are forever"

  2. #12
    Board Regular My Aswer Is This's Avatar
    Join Date
    Jul 2014
    Posts
    15,808
    Post Thanks / Like
    Mentioned
    28 Post(s)
    Tagged
    13 Thread(s)

    Default Re: VBA: Copy different sheet in same workbook multiple times, naming according to list in cells

    If you get a message saying there was a error.
    You may be using a duplicate name
    No two sheets can have the same name
    Or you may be trying to name a sheet a improper name.
    Excel does not like some characters in a sheet name.

    Like it does not like:


    7/7/2019

    It will accept
    7-7-2019

    And there may be more characters it does not like.
    Be sure and always test this script on sample data the first time you use this as to avoid any problems with your data. Always trying to learn more and help others where I can. I'm using Excel 2013.
    Patience please Iím not perfect yet. "Memories are forever"

  3. #13
    Board Regular
    Join Date
    Dec 2013
    Posts
    98
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA: Copy different sheet in same workbook multiple times, naming according to list in cells

    Thanks! Works perfectly again... It's only going to be forenames in the list so shouldn't ever include incomatible characters

  4. #14
    Board Regular My Aswer Is This's Avatar
    Join Date
    Jul 2014
    Posts
    15,808
    Post Thanks / Like
    Mentioned
    28 Post(s)
    Tagged
    13 Thread(s)

    Default Re: VBA: Copy different sheet in same workbook multiple times, naming according to list in cells

    Glad I was able to help you.
    Come back here to Mr. Excel next time you need additional assistance.
    Quote Originally Posted by RichCowell View Post
    Thanks! Works perfectly again... It's only going to be forenames in the list so shouldn't ever include incomatible characters
    Be sure and always test this script on sample data the first time you use this as to avoid any problems with your data. Always trying to learn more and help others where I can. I'm using Excel 2013.
    Patience please Iím not perfect yet. "Memories are forever"

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •