View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jason Morin Jason Morin is offline
external usenet poster
 
Posts: 63
Default Help Inputting a Name in a Macro

Try something like:

Sub Test()
Dim NewSh As Worksheet
Dim sNewName As String

Set NewSh = Sheets.Add

NewName:
On Error GoTo NotValidName
sNewName = InputBox("Give the new sheet a name:", _
"New Name")
NewSh.Name = sNewName
Exit Sub

NotValidName:
MsgBox "Sorry, that is not a valid name."
Resume NewName

End Sub

---
HTH
Jason
Atlanta, GA

-----Original Message-----
Hey,

Can someone provide me with the code to have a dialog

box come up in
the middle of my macro after creating a new sheet and

have a dialog box
come up that the user can type something into and that

will be what the
sheet's name is.

Thanks

Andrew

.