Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Help Inputting a Name in a Macro

thanks, works perfect

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with inputting code Morgan New Users to Excel 3 February 26th 10 12:24 AM
Inputting criteria into a macro/vb code Marie Bayes Excel Discussion (Misc queries) 9 December 9th 07 12:17 PM
Inputting numbers using a macro. wazcaster Excel Discussion (Misc queries) 1 September 10th 07 11:38 AM
Inputting date as dd/mm not mm/dd MichaelH Excel Discussion (Misc queries) 2 May 26th 07 11:42 AM
inputting data Shanor Excel Discussion (Misc queries) 0 June 15th 06 10:50 AM


All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"