Sub AddSheetsWithNames()
'Adds new sheets and names them from the selected cells
Dim Rng As Range
Dim c As Range
Dim ws As Worksheet
Dim i As Integer
Dim WSName As String
Set Rng = Selection
For Each c In Rng
If c.Value <> "" Then
WSName = c.Value
Set ws = Sheets.Add(after:=Sheets(Sheets.Count))
If WorksheetExists(WSName) = True Then 'The name already exists (needs the following function to work)
i = 1
Do While WorksheetExists(WSName & i) = True
i = i + 1
Loop
WSName = WSName & i
End If
ws.Name = WSName
End If
Next c
'Goes back to the original sheet:
Rng.Parent.Activate
End Sub
Function WorksheetExists(ByVal WorksheetName As String) As Boolean
On Error Resume Next
WorksheetExists = (Sheets(WorksheetName).Name <> "")
On Error GoTo 0
End Function
Sub TabNames()
'Lists the sheet names under the active cell
Dim i As Integer
For i = 1 To Worksheets.Count
ActiveCell.Offset(i).Value = Sheets(i).Name
Next i
End Sub
Sub NamedRangesOnTab()
'Lists the named ranges that refer to this sheet from the activecell on
Dim N As Name
Dim i As Integer
For Each N In ActiveWorkbook.Names
If InStr(N, ActiveSheet.Name) > 0 Then
ActiveCell.Offset(i).Value = N.Name
ActiveCell.Offset(i, 1).Value = Replace(N.RefersTo, "=", "")
i = i + 1
End If
Next N
End Sub