I found this code online, that copies "Sheet2" and renames the new worksheet based on a range listed on "Sheet1" (starting in A2). If "Sheet1" was renamed to "Listing", how do I modify this code in order to make sure that the code will always pull from "Listing" and not "Sheet1"?
Sub AddSheet()
Application.ScreenUpdating = False
Dim bottomA As Integer
bottomA = Range("A" & Rows.Count).End(xlUp).Row
Dim c As Range
Dim ws As Worksheet
For Each c In Range("A2:A" & bottomA)
Set ws = Nothing
On Error Resume Next
Set ws = Worksheets(c.Value)
On Error GoTo 0
If ws Is Nothing Then
Sheets("Sheet2").Select
Sheets("Sheet2").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = c.Value
End If
Next c
Application.ScreenUpdating = True
End Sub
Bookmarks