Hello there,
I might also suggest making use of a UDF to test if a sheet exists or not...
IN YOUR WORKSHEET MODULE
Option Explicit
Private Sub CommandButton1_Click()
Dim s As Worksheet, sName As String
ActiveSheet.Copy After:=ActiveSheet
Set s = ActiveSheet
Call CommandButton2_Click
If DoesWsExist("Kitchen") Then
sName = InputBox("Give Room a Unique Name.", "Name")
If sName <> "" And DoesWsExist(sName) = False Then
s.Name = sName
End If
Else: s.Name = "Kitchen"
End If
s.Range("C2").Value = s.Name
End Sub
Private Sub CommandButton2_Click()
Dim c As Range
For Each c In ActiveSheet.UsedRange
If Not c.Locked Then
c.ClearContents
If c.MergeCells Then
c.MergeArea.ClearContents
End If
End If
Next c
End Sub
IN A STANDARD MODULE
Public Function DoesWsExist(wsName As String) As Boolean
Dim ws As Worksheet
On Error Resume Next
Set ws = Worksheets(wsName)
DoesWsExist = IIf(Not ws Is Nothing, True, False)
End Function