Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default vb code for renaming a work sheet with a cell reference

I would like to change the sheet name automatically whenever a cell reference
is changed
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default vb code for renaming a work sheet with a cell reference

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H10" '<=== 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 = .Name
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

(replace somewhere in email address with gmail if mailing direct)

"John Britto" wrote in message
...
I would like to change the sheet name automatically whenever a cell

reference
is changed



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default vb code for renaming a work sheet with a cell reference

What you need is a worksheet_change event. Right click the sheet tabview
codeleft window select worksheetright window select changeput in your
macro

if target.address="$A$1" then activesheet.name=target

--
Don Guillett
SalesAid Software

"John Britto" wrote in message
...
I would like to change the sheet name automatically whenever a cell
reference
is changed



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27,285
Default vb code for renaming a work sheet with a cell reference

think Bob meant

Me.Name = .Name
should be
Me.Name = .Value


--
Regards,
Tom Ogilvy


"Bob Phillips" wrote in message
...
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H10" '<=== 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 = .Name
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

(replace somewhere in email address with gmail if mailing direct)

"John Britto" wrote in message
...
I would like to change the sheet name automatically whenever a cell

reference
is changed





Reply
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
Selecting Last Sheet Bonbon Excel Worksheet Functions 17 February 22nd 06 04:16 PM
Input cell reference is not valid (One Variable Data Table) Dottore Excel Worksheet Functions 9 September 1st 05 03:05 PM
Clicking Cell Link Changes Cell on Another Sheet nshah Excel Discussion (Misc queries) 1 August 31st 05 01:50 AM
indirect function to reference cell on different sheet Dolemite Excel Worksheet Functions 2 August 19th 05 05:25 PM
Using a cell reference of a sheet in Vlookup crazybass2 Excel Worksheet Functions 3 August 12th 05 07:51 PM


All times are GMT +1. The time now is 06:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"