PC Review


Reply
Thread Tools Rate Thread

Code to Change Sheet Name

 
 
Sean
Guest
Posts: n/a
 
      1st Dec 2007
How could I create a UserForm that willchange the Sheet name on the
active sheet? I know this is over complication but I have users that
find this hard to do!

I am looking for the input text to be in PROPER case

Thanks
 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      1st Dec 2007
No need for a user form. Try something like

Sub RenameSheet()
Dim V As Variant
V = Application.InputBox(prompt:="Enter New Name", Type:=2)
If VarType(V) = vbBoolean Then
If V = False Then
Debug.Print "user cancelled"
Exit Sub
End If
End If
On Error Resume Next
If Worksheets(V) Is Nothing Then
ActiveSheet.Name = StrConv(V, vbProperCase)
Else
MsgBox "Sheet already exists"
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Sean" <(E-Mail Removed)> wrote in message
news:b4295d99-9bab-4901-9eac-(E-Mail Removed)...
> How could I create a UserForm that willchange the Sheet name on the
> active sheet? I know this is over complication but I have users that
> find this hard to do!
>
> I am looking for the input text to be in PROPER case
>
> Thanks


 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      1st Dec 2007
An example to get you going.....

Sub Cname()
myname = Trim(InputBox("Enter Name for Active Sheet", "Rename Sheet",
ActiveSheet.Name))
On Error GoTo errHandler
ActiveSheet.Name = Application.WorksheetFunction.Proper(myname)
Exit Sub
errHandler:
MsgBox "Invalid Name"
On Error GoTo 0
End Sub



--

Regards,
Nigel
(E-Mail Removed)



"Sean" <(E-Mail Removed)> wrote in message
news:b4295d99-9bab-4901-9eac-(E-Mail Removed)...
> How could I create a UserForm that willchange the Sheet name on the
> active sheet? I know this is over complication but I have users that
> find this hard to do!
>
> I am looking for the input text to be in PROPER case
>
> Thanks


 
Reply With Quote
 
Sean
Guest
Posts: n/a
 
      1st Dec 2007
Chip, once again you are a fountain of knowledge, many Thanks. Also to
you Nigel

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Sheet references in code? Bassman62 Microsoft Excel Programming 4 22nd Apr 2009 10:16 PM
Code to change code in a sheet and workbook module Otto Moehrbach Microsoft Excel Programming 11 11th Nov 2007 07:20 PM
Trouble with Code to change sheet name =?Utf-8?B?Sk9VSU9VSQ==?= Microsoft Excel Programming 3 6th Jul 2006 04:15 PM
Sheet change code =?Utf-8?B?R29yZG9u?= Microsoft Excel Programming 2 3rd May 2006 11:08 PM
Change Listbox Sheet reorder code Stuart Microsoft Excel Programming 3 2nd May 2005 07:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:16 PM.