Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Automatic Sheet Naming

If I have a list of people in the A column, is there a way for the worksheet
tabs reflect those names automatically?

Example:

Sheet1:
A1: Joe
A2: Bob
A3: Bill

Sheet2 renames to what is in A1, or Joe
Sheet3 renames to what is in A2, or Bob
Sheet4 renames to what is in A3, or Bill

Then I rename A1 to Albert, and Sheet2 or the €œJoe€ sheet automatically
becomes Albert now. Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Automatic Sheet Naming

Sub renamre()
Sheets("Sheet1").Activate
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
Sheets(i + 1).Name = Cells(i, 1).Value
Next
End Sub

--
Gary''s Student - gsnu200772
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Automatic Sheet Naming

"Gary''s Student" wrote:

Sub renamre()
Sheets("Sheet1").Activate
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
Sheets(i + 1).Name = Cells(i, 1).Value
Next
End Sub

--
Gary''s Student - gsnu200772


Gary,

Thank you for the answer, but will this be automatic - i.e. as soon as
cell A1 is changed, sheet2 is renamed?

Thanks
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Automatic Sheet Naming

Put this Event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set a = Range("A:A")
If Intersect(t, a) Is Nothing Then Exit Sub
n = t.Row
Sheets(n + 1).Name = t.Value
End Sub

--
Gary''s Student - gsnu200772


"Jeff Lowenstein" wrote:

"Gary''s Student" wrote:

Sub renamre()
Sheets("Sheet1").Activate
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
Sheets(i + 1).Name = Cells(i, 1).Value
Next
End Sub

--
Gary''s Student - gsnu200772


Gary,

Thank you for the answer, but will this be automatic - i.e. as soon as
cell A1 is changed, sheet2 is renamed?

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Automatic Sheet Naming

Gary, how would you rename the tab with a Text Box on a worksheet? Not a
userform

I've tried the following doesn't seem to work.

Private Sub TextBox127_LostFocus()
ActiveSheet.Name = Me.Textbox127.value
End Sub


"Gary''s Student" wrote:

Put this Event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set a = Range("A:A")
If Intersect(t, a) Is Nothing Then Exit Sub
n = t.Row
Sheets(n + 1).Name = t.Value
End Sub

--
Gary''s Student - gsnu200772


"Jeff Lowenstein" wrote:

"Gary''s Student" wrote:

Sub renamre()
Sheets("Sheet1").Activate
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
Sheets(i + 1).Name = Cells(i, 1).Value
Next
End Sub

--
Gary''s Student - gsnu200772


Gary,

Thank you for the answer, but will this be automatic - i.e. as soon as
cell A1 is changed, sheet2 is renamed?

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
Naming a sheet Mike Excel Discussion (Misc queries) 3 March 7th 07 08:43 AM
Automatic naming Worksheet tabs rhani111[_9_] Excel Programming 2 June 26th 06 01:40 PM
Automatic naming Worksheet tabs rhani111[_8_] Excel Programming 4 June 26th 06 10:37 AM
Automatic Range Naming using Advanced Filter? ArthurJ Excel Programming 2 August 26th 05 04:51 PM
Automatic sheet naming Hans Weustink Excel Programming 3 October 23rd 03 09:32 AM


All times are GMT +1. The time now is 01:29 AM.

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"