ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User input to name a sheet? (https://www.excelbanter.com/excel-programming/352304-user-input-name-sheet.html)

StargateFan[_3_]

User input to name a sheet?
 
I must be asking for the wrong thing in the archives as nothing
pertinent to this is coming up. I'd like to be able to take user
input to name sheets copied from a hidden template.

What I mean is that right now workbook works well, user clicks button
in floating toolbar and a copy of the hidden template is made and I
then prompt user to change the tab name to something pertinent. We're
ready to move on and to instead have a message box come up to prompt
the user to enter a tab name that will then rename that new sheet.

Is there a way to do this?

Thanks. :oD


Pointless[_4_]

User input to name a sheet?
 

??? dont know if i unerstand you, but something like this should work.


Code
-------------------

Sub renameWorksheet()
Dim NewName As String

NewName = InputBox("Give the tab a new name", "Rename")

If NewName = "" Then
NewName = InputBox("Go ahead, make my day, please, please", "Rename")
If NewName = "" Then Exit Sub
End If

ActiveSheet.Name = NewName

End Sub


-------------------

--
Pointles
-----------------------------------------------------------------------
Pointless's Profile: http://www.excelforum.com/member.php...fo&userid=3086
View this thread: http://www.excelforum.com/showthread.php?threadid=50811


StargateFanFromWork[_3_]

User input to name a sheet?
 
PERFECT!!! It's my last day here in this contract so was just able to fix
up the macro. XL2K is too neat for words. They have a button that copies a
hidden template sheet and now also asks them for a name, all in one click!
Kewl.

Thanks! :oD

"Pointless" wrote
in message ...

??? dont know if i unerstand you, but something like this should work.


Code:
--------------------

Sub renameWorksheet()
Dim NewName As String

NewName = InputBox("Give the tab a new name", "Rename")

If NewName = "" Then
NewName = InputBox("Go ahead, make my day, please, please", "Rename")
If NewName = "" Then Exit Sub
End If

ActiveSheet.Name = NewName

End Sub


--------------------


--
Pointless
------------------------------------------------------------------------
Pointless's Profile:

http://www.excelforum.com/member.php...o&userid=30862
View this thread: http://www.excelforum.com/showthread...hreadid=508112





All times are GMT +1. The time now is 11:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com