From: JuneS on
Is there a way to change the names of worksheets automatically? I use Excel
2007 for invoicing, but it's really a pain to have to rename each sheet to
reflect my invoice number.

Is there a formula or solution for this?

Thanks!
From: Bob Phillips on
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H5" '<== change to cell with invoice number

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Me.Name = Target.Value
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.


--

HTH

Bob

"JuneS" <JuneS(a)discussions.microsoft.com> wrote in message
news:66342604-8872-4B33-81C3-20364065F43B(a)microsoft.com...
> Is there a way to change the names of worksheets automatically? I use
> Excel
> 2007 for invoicing, but it's really a pain to have to rename each sheet to
> reflect my invoice number.
>
> Is there a formula or solution for this?
>
> Thanks!


From: מיכאל (מיקי) אבידן on
Assuming the Invoice Number is located in cell F4 on each and every sheet and
its format/shape/size/used characters is "legitimate" for a sheets name -
put the following Event-Macro into the ThisWorkBook Module:
----------------------------------------------
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
If Target.Address = "$F$4" Then ActiveSheet.Name = [F4]
End Sub
----------------
Micky


"JuneS" wrote:

> Is there a way to change the names of worksheets automatically? I use Excel
> 2007 for invoicing, but it's really a pain to have to rename each sheet to
> reflect my invoice number.
>
> Is there a formula or solution for this?
>
> Thanks!