Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Code to Change Sheet Name

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Code to Change Sheet Name

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" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 735
Default Code to Change Sheet Name

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




"Sean" wrote in message
...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Code to Change Sheet Name

Chip, once again you are a fountain of knowledge, many Thanks. Also to
you Nigel

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
Code to change code in a sheet and workbook module Otto Moehrbach Excel Programming 11 November 11th 07 07:20 PM
Change Error Messaga from Sheet Code Drahos Excel Programming 12 September 12th 06 04:04 PM
Trouble with Code to change sheet name JOUIOUI Excel Programming 3 July 6th 06 04:15 PM
Sheet change code Gordon[_2_] Excel Programming 2 May 3rd 06 11:08 PM
Change Listbox Sheet reorder code Stuart[_21_] Excel Programming 3 May 2nd 05 07:26 AM


All times are GMT +1. The time now is 07:55 PM.

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

About Us

"It's about Microsoft Excel"