LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
D D is offline
external usenet poster
 
Posts: 121
Default name tab from cell value

Thanks Gary, have run into a further problem -
The contents of cell B7 on all 125 sheets provides the name for the sheet
tab. Cell B7 gets its information from a separate master sheet i.e.
=Master!C6

When I sort the master sheet (because new entries have been added at the
bottom and need to be arranged according to a ref. code) I get an error
message: Runtime error 1004 Cannot rename a sheet to the same name as
another sheet, a referenced object library or a workbook referenced by Visual
Basic.

I do want the tab names to change as a result of the master sheet sort,
because the individual sheets take their info from the master sheet too...can
I email you the file as an attachment?

Any ideas? Am now off to bed as nearly midnight. Thank you so much for
your support - I am learning so much and really appreciate the time you are
taking to help me resolve this!


"GaryDK" wrote:

Hi Denise,

The simplest way to handle that, and a better way, is to make your name
cells on each sheet named ranges (Insert | Name | Define). For example,
if the cell is named "DataSheet" on the sheet, you could enter the
following in its module:

Option Explicit

Private Sub Worksheet_Calculate()
On Error GoTo ErrorTrap
If Range("DataSheet").Value < Me.Name Then
Me.Name = Range("DataSheet").Value
End If
Exit Sub
ErrorTrap:
MsgBox "New sheet name in range DataSheet " & _
"contains invalid characters."
End Sub

Then you can enter the same code in another sheet's module, replacing
"DataSheet" with whatever the defined name is for that particular
sheet's "name cell". Great catch on the illegal characters, so it now
traps errors. There could be other errors, like the range name not
existing, or misspelling the name in the code, but I assume you'd catch
that in testing.

Gary


 
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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Worksheet Functions 1 August 22nd 08 02:04 AM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


All times are GMT +1. The time now is 05:09 AM.

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"