Dim SheetName As String
SheetName = InputBox("Enter Sheet Name")
If SheetName < "" Then CreateSheet SheetName
....
Public Sub CreateSheet(SheetName As String)
'
' if the sheet already exists select it
'
On Error GoTo CreateNewSheet
Sheets(SheetName).Select
Exit Sub
'
' if not create it
'
CreateNewSheet:
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = SheetName
'
End Sub
"Petitboeuf" wrote:
Hiya experts!!
I have recorded!!!!
(shame? naaah I have no shame!! :) ) a
macro that inserts new spreadsheets into the workbook and it just fails
to deliver because of the set name e.g. "Sheet2".
Could you please let me know how to make this new sheet a variable and
then via a msgBox enable the user to rename it? I guess it would be
something like that:
Sheets("VARIABLE").Name = "msgBox INPUT"
Many thanks!!
--
Petitboeuf
------------------------------------------------------------------------
Petitboeuf's Profile: http://www.excelforum.com/member.php...o&userid=10602
View this thread: http://www.excelforum.com/showthread...hreadid=495170