ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Renaming Sheets automatically (https://www.excelbanter.com/excel-programming/305000-renaming-sheets-automatically.html)

Tami[_4_]

Renaming Sheets automatically
 
Hi I know i posted this before but I unfortuantely had all my messages
removed from my connection,

Can I please have help

I am trying to rename the sheet on the tab to the name in cell a14

for example from sheet1 to xyz inc.

and I am not sure how private subs work

Thanks in advance once again

Tami



Bob Phillips[_6_]

Renaming Sheets automatically
 
Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A14")) 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.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Tami" wrote in message
...
Hi I know i posted this before but I unfortuantely had all my messages
removed from my connection,

Can I please have help

I am trying to rename the sheet on the tab to the name in cell a14

for example from sheet1 to xyz inc.

and I am not sure how private subs work

Thanks in advance once again

Tami





Tami[_4_]

Renaming Sheets automatically
 
Thankyou it works great

"Bob Phillips" wrote in message
...
Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A14")) 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.



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Tami" wrote in message
...
Hi I know i posted this before but I unfortuantely had all my messages
removed from my connection,

Can I please have help

I am trying to rename the sheet on the tab to the name in cell a14

for example from sheet1 to xyz inc.

and I am not sure how private subs work

Thanks in advance once again

Tami








All times are GMT +1. The time now is 10:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com