Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B6" '<== 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 on the sheet tab, select
'the View Code option from the menu, and paste the code in.

Signature
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
> Hi,
> A cell (say B6) has a formula that reads the text value from another cell
[quoted text clipped - 3 lines]
> Is it possible to have VBA code so that the sheet name will be equal to
> the value in that cell (in my example) cell B6
Something like this maybe...
Sub ChangeSheetName()
With ActiveSheet
.Name = .Range("B6").Value
End With
End Sub
Change the ActiveSheet reference if you are not running this code from the
sheet you want to affect.
Rick
> Hi,
> A cell (say B6) has a formula that reads the text value from another cell
[quoted text clipped - 3 lines]
> Is it possible to have VBA code so that the sheet name will be equal to
> the value in that cell (in my example) cell B6
Khalil Handal - 29 May 2008 14:17 GMT
This worked as a macro. How can it be done so that it runs automatically.
Bob's Suggestion did't work out!
> Something like this maybe...
>
[quoted text clipped - 16 lines]
>> Is it possible to have VBA code so that the sheet name will be equal to
>> the value in that cell (in my example) cell B6
Nick - 29 May 2008 14:32 GMT
> This worked as a macro. How can it be done so that it runs automatically.
> Bob's Suggestion did't work out!
Worked for me first time, cut a paste. Excel 2003
Gord Dibben - 29 May 2008 15:35 GMT
Bob's code requires you to manually change the value in B6
Try this calculate event.
Private Sub Worksheet_Calculate()
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("B6")
If .Value <> "" Then
Me.Name = .Value
End If
End With
stoppit:
Application.EnableEvents = True
End Sub
Gord Dibben MS Excel MVP
>This worked as a macro. How can it be done so that it runs automatically.
>Bob's Suggestion did't work out!
[quoted text clipped - 19 lines]
>>> Is it possible to have VBA code so that the sheet name will be equal to
>>> the value in that cell (in my example) cell B6
Khalil Handal - 29 May 2008 19:44 GMT
Thanks to all of you it worked well.
> Bob's code requires you to manually change the value in B6
>
[quoted text clipped - 39 lines]
>>>> Is it possible to have VBA code so that the sheet name will be equal to
>>>> the value in that cell (in my example) cell B6