Help Inputting a Name in a Macro
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 |
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 . |
Help Inputting a Name in a Macro
thanks, works perfect
|
All times are GMT +1. The time now is 08:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com