View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Is there a way to setup Worksheet Tab Descriptions based on ce

If you want all of the sheets renamed on open then give this a try. It must
be placed in ThisWorkbook (Right click the Excel icon beside File in the menu
bar and select view code). The error handler is necessary if you try to name
the sheet something not allowed (such as duplicating an existing sheet name,
a sheet name that is too long or naming the sheet "history")...

Private Sub Workbook_Open()
Dim wks As Worksheet

On Error Resume Next
For Each wks In Worksheets
wks.Name = wks.Range("A1").Value
Next wks
On Error GoTo 0
End Sub


--
HTH...

Jim Thomlinson


"mscone2000" wrote:

How do I get this code to fire upon opening the spreadsheet?
--
Thanks for your help
MsCone


"Tom Ogilvy" wrote:

With the limited information provided:

go to the thisworkbook module. Assume you want to rename the sheet to match
the value in cell A1 of that sheet. Put is code like this:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
if Target.Address = "$A$1" then
sh.name = Target.Text
End if
End Sub

--
regards,
Tom Ogilvy



"mscone2000" wrote:

I would like to setup tab descriptions that are conditional based on cell
info. Is it possible? If so, can you send me example?
--
Thanks for your help
MsCone