Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 147
Default Name a worksheet tab based on the value in a cell.

Hello all,

I have found a lot of posts about how to populate a cell with the value in
the worksheet tab name, but not the other way around. I would like to
automatically name the worksheet tab based on the value in a specific cell.

I'm ok with formula's but not "up" on VB. Is there a formula I could use to
accomplish this?

Thanks in advance for any help you can give me.

Christine
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 376
Default Name a worksheet tab based on the value in a cell.

Hi Christine

These 2 subs will do the task.
The first will just name the Active Sheet.
The second will run through the file and name all sheets according to
the value in cell A1 - provided A1 contains a value.

Sub NameSheet()
If Range("A1") < "" Then
ActiveSheet.Name = Range("A1").Value
End If

ActiveSheet.Name = Range("A1").Value

End Sub

Sub NameSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
If ws.Range("A1") < "" Then
ws.Name = ws.Range("A1").Value
End If
Next ws
End Sub

To install
Copy code as above
Alt+F11 to invoke the Vb Editor
Alt+I+M to Insert a new module
Paste the code into the white pane that appears
Alt+F11 to return to Excel

To Use
Alt+F8
Select the macro to use
Run

--
Regards
Roger Govier

Christine wrote:
Hello all,

I have found a lot of posts about how to populate a cell with the value in
the worksheet tab name, but not the other way around. I would like to
automatically name the worksheet tab based on the value in a specific cell.

I'm ok with formula's but not "up" on VB. Is there a formula I could use to
accomplish this?

Thanks in advance for any help you can give me.

Christine

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
Macro to open worksheet based on name in cell Sunnyskies Excel Discussion (Misc queries) 5 February 26th 09 07:20 PM
Hyperlink based on cell value in a different worksheet Bart Excel Worksheet Functions 3 October 24th 07 08:34 PM
Create Cell Comment based on text in a cell on another worksheet Dave Fellman Excel Discussion (Misc queries) 2 March 15th 07 09:49 AM
Need to find a row in a worksheet based on the value of a cell Ginger Excel Worksheet Functions 1 September 6th 05 10:43 PM
update cell in other worksheet based... mwrfsu Excel Worksheet Functions 0 August 19th 05 05:22 PM


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