LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,722
Default naming a tab based on a cells value

Put this in the Workbook module

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)

Dim EndNumber as String
On Error resume next
EndNumber = 0
sh.Name = sh.Range("a1").Value
Retest:
if err.number < 0 then
EndNumber=EndNumber + 1
err.clear
sh.Name = sh.Range("a1").Value + "(" + EndNumber + ")"
goto Retest
end if

end sub

If there is already a sheet with the same name, this will add a 1, 2, etc at
the end. If you put it in the workbook module, it should run automatically.
--
Best Regards,

Luke M


" wrote:

Is there a way to name a sheet/tab by a value which is in A1 on its
corresponding sheet?

~Andrew

 
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
Creating/Naming New Worksheets Based on Select Cells in Master Worksheet Lilbit Excel Worksheet Functions 2 March 19th 08 05:05 PM
Naming worksheets based on a cell value FatBear Excel Programming 8 April 26th 07 01:44 PM
Naming cells in a table based on column and row label [email protected] Excel Discussion (Misc queries) 3 December 3rd 06 11:16 AM
naming a file based on cell value? nokia3650 Excel Programming 2 August 3rd 06 07:13 AM
naming .xls file based on a cell in excel lsu-i-like Excel Discussion (Misc queries) 1 June 24th 05 09:44 PM


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