Hello,
I'm using the code below to copy and rename worksheets. However i what the sheets that I copy from to be hidden. When I hide those sheets and try to copy i get an error. What code needs to be added?
I'm using the code below to copy and rename worksheets. However i what the sheets that I copy from to be hidden. When I hide those sheets and try to copy i get an error. What code needs to be added?
Code:
Sub AutoAddSheet()
Dim MyCell As Range, MyRange As Range
Set MyRange = Sheets("Master").Range("B17")
Set MyRange = Range(MyRange, MyRange.End(xlDown))
For Each MyCell In MyRange
Sheets(MyCell.Value).Copy After:=Sheets(Sheets.Count) 'Create a new worksheet as a copy of Sheet number
Sheets(Sheets.Count).Name = MyCell.Offset(0, -1).Value 'Renames the new worksheets
Next MyCell
Worksheets("Master").Activate
End Sub [cpde]
Thanks for the help!