Input Box to rename a Sheet?

G

Guest

Can I create a macro that uses an input box to rename a Worskheet? I'm trying to combine several macros into one macro. So far, renaming the sheet has been the hardest thing to incorporate. I received an answer earlier on how to rename the active sheet to the value in the active cell. Now, I'm looking for another variation
Can I create a macro that uses an iput box to rename a Worskheet
Any help would be most appreciated
tj
 
B

Bob Phillips

sName = InputBox("Supply a new name")
If sName <> "" then
Worksheets("Sheet1").Name = sName
End If

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

tjtjjtjt said:
Can I create a macro that uses an input box to rename a Worskheet? I'm
trying to combine several macros into one macro. So far, renaming the sheet
has been the hardest thing to incorporate. I received an answer earlier on
how to rename the active sheet to the value in the active cell. Now, I'm
looking for another variation.
 
D

dcronje

Try this it works for me.


Sub SheetbyInput()

Dim wsActive As Worksheet
Dim iptResult As String

Set wsActive = ActiveSheet
iptResult = InputBox("Type name of sheet")

wsActive.Name = iptResult

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top