Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default VBA Code to Change the Tab Name

I have the following code that someone helped me with yesterday that is used
to change the name of the tab to whatever name is in cell "C1.":

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("C1"), Target) Is Nothing Then
Exit Sub
End If
v = Target.Value
ActiveSheet.Name = v
End Sub

The problem is that is seems to work sometimes and then will stop. Or it
won't work when I try to copy the page, etc.

Is there some trick I'm missing? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default VBA Code to Change the Tab Name

Try this and remember you can't have tabs with same name

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("C1").Value = "" Then End
ActiveSheet.Name = Range("C1").Value
End Sub


"Michael in Texas" wrote:

I have the following code that someone helped me with yesterday that is used
to change the name of the tab to whatever name is in cell "C1.":

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Range("C1"), Target) Is Nothing Then
Exit Sub
End If
v = Target.Value
ActiveSheet.Name = v
End Sub

The problem is that is seems to work sometimes and then will stop. Or it
won't work when I try to copy the page, etc.

Is there some trick I'm missing? Thanks!

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
VBA Code to Change the Tab Name Gary''s Student Excel Discussion (Misc queries) 0 March 28th 07 12:05 AM
change SUMIF formula into a vb code ASU Excel Discussion (Misc queries) 1 September 6th 06 07:08 PM
combo box on change code frendabrenda1 Excel Discussion (Misc queries) 0 April 10th 06 04:21 PM
change the code to be a formula Little pete Excel Discussion (Misc queries) 1 November 30th 05 07:29 PM
Running code on a drop down selection change Steve Haack Excel Worksheet Functions 1 April 26th 05 05:03 AM


All times are GMT +1. The time now is 01:13 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"