View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default *How can you rename a tab based on a cell value

Hi Gord,

Just do it in Calculate.

Private Sub Worksheet_Calculate()
Me.Name = Range("A1").Value
End Sub

Of course it does mean it happens for every formula/value change that will
trigger a calculate.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Bob

How do I get this to work with a Calculated value in A1?

Like A1 has formula of =E1*F1 with F1 being changed.

Private Sub Worksheet_Calculate() doesn't do it for me.

Could be I don't understand what triggers the Calculate event<g


Gord

On Sat, 2 Dec 2006 19:35:10 -0000, "Bob Phillips"
wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Name = .Value
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click


Gord Dibben MS Excel MVP