Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Darren
 
Posts: n/a
Default Changing Tabs to Specific Cells

Is there a way to change the tab names (20 of them) to the cells in say
A1:A20? When the names are changed in the cells, I need the tabs names to
reflect what the cells reflect.
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default Changing Tabs to Specific Cells

Darren-

Place this code in the appropriate sheet module:

Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range
Set rng = Me.[A1:A20]

If Target.Row ActiveWorkbook.Worksheets.Count Then Exit Sub

On Error GoTo ErrHandler
Sheets(Target.Row).Name = Target.Value
Exit Sub

ErrHandler:
MsgBox "Invalid sheet name. Try again."
Target.Select

End Sub

---
HTH
Jason
Atlanta, GA


"Darren" wrote:

Is there a way to change the tab names (20 of them) to the cells in say
A1:A20? When the names are changed in the cells, I need the tabs names to
reflect what the cells reflect.

  #3   Report Post  
Jason Morin
 
Posts: n/a
Default Changing Tabs to Specific Cells

Oops...forgot one extremely important line of code:

If Intersect(Target, rng) Is Nothing Then Exit Sub

Add this under the "Set rng = ..." line. Sorry.

Jason

"Jason Morin" wrote:

Darren-

Place this code in the appropriate sheet module:

Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range
Set rng = Me.[A1:A20]

If Target.Row ActiveWorkbook.Worksheets.Count Then Exit Sub

On Error GoTo ErrHandler
Sheets(Target.Row).Name = Target.Value
Exit Sub

ErrHandler:
MsgBox "Invalid sheet name. Try again."
Target.Select

End Sub

---
HTH
Jason
Atlanta, GA


"Darren" wrote:

Is there a way to change the tab names (20 of them) to the cells in say
A1:A20? When the names are changed in the cells, I need the tabs names to
reflect what the cells reflect.

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
changing the way Excel displays selected cells P Boric Excel Discussion (Misc queries) 1 July 28th 05 01:09 PM
Formula for counting specific cells with value greater than 0 mmock Excel Discussion (Misc queries) 1 April 26th 05 03:39 AM
My excel 2003 wont let me fill cells with color or color the tabs. trizog New Users to Excel 2 February 22nd 05 06:43 PM
Showing zero in specific cells Swingbridge. Excel Discussion (Misc queries) 2 February 12th 05 04:56 AM
print specific cells Wendy Excel Discussion (Misc queries) 1 February 10th 05 06:52 PM


All times are GMT +1. The time now is 08:31 PM.

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

About Us

"It's about Microsoft Excel"