Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sheet's Name

HI ALL ! I want to automatically change the name of cell A1 when I
change the sheet's name.
For example:
Cell A1=JANUARY
Sheet 1=JANUARY

When i write FEBRUARY I want that cell A1 = February but i need it to
change automatically.

TIA

MARTIN


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Sheet's Name

Martin,

Put the following code in the code module for the worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$1" Then
Me.Name = Range("A1").Value
End If
If Err.Number < 0 Then
MsgBox "Error naming sheet: " & Err.Description
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Martín2626 " wrote in
message ...
HI ALL ! I want to automatically change the name of cell A1

when I
change the sheet's name.
For example:
Cell A1=JANUARY
Sheet 1=JANUARY

When i write FEBRUARY I want that cell A1 = February but i need

it to
change automatically.

TIA

MARTIN


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sheet's Name

Thanks but it doesn't work. When i change the sheet's name nothin
happens in cell a1.
Other way???



Chip Pearson wrote:
*Martin,

Put the following code in the code module for the worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$1" Then
Me.Name = Range("A1").Value
End If
If Err.Number < 0 Then
MsgBox "Error naming sheet: " & Err.Description
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Martín2626 " wrote in
message ...
HI ALL ! I want to automatically change the name of cell A1

when I
change the sheet's name.
For example:
Cell A1=JANUARY
Sheet 1=JANUARY

When i write FEBRUARY I want that cell A1 = February but i need

it to
change automatically.

TIA

MARTIN


---
Message posted from http://www.ExcelForum.com/


--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Sheet's Name

Martin,

Where did you put the code? It should go in the worksheet's code
module, not a regular code module or the ThisWorkbook code
module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Martín2626 " wrote in
message ...
Thanks but it doesn't work. When i change the sheet's name

nothing
happens in cell a1.
Other way???



Chip Pearson wrote:
*Martin,

Put the following code in the code module for the worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$1" Then
Me.Name = Range("A1").Value
End If
If Err.Number < 0 Then
MsgBox "Error naming sheet: " & Err.Description
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Martín2626 "

wrote in
message ...
HI ALL ! I want to automatically change the name of cell A1

when I
change the sheet's name.
For example:
Cell A1=JANUARY
Sheet 1=JANUARY

When i write FEBRUARY I want that cell A1 = February but i

need
it to
change automatically.

TIA

MARTIN


---
Message posted from http://www.ExcelForum.com/
*



---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Sheet's Name

Martin,

I misread your question. To return the sheet's name back to a
cell, use the following formula

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,99)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Martin,

Where did you put the code? It should go in the worksheet's

code
module, not a regular code module or the ThisWorkbook code
module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Martín2626 " wrote

in
message ...
Thanks but it doesn't work. When i change the sheet's name

nothing
happens in cell a1.
Other way???



Chip Pearson wrote:
*Martin,

Put the following code in the code module for the

worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$1" Then
Me.Name = Range("A1").Value
End If
If Err.Number < 0 Then
MsgBox "Error naming sheet: " & Err.Description
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Martín2626 "

wrote in
message ...
HI ALL ! I want to automatically change the name of cell

A1
when I
change the sheet's name.
For example:
Cell A1=JANUARY
Sheet 1=JANUARY

When i write FEBRUARY I want that cell A1 = February but

i
need
it to
change automatically.

TIA

MARTIN


---
Message posted from http://www.ExcelForum.com/
*



---
Message posted from http://www.ExcelForum.com/







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sheet's Name

THANKS, THIS FORMULA WORKS PERFECT !!!!

MARTIN






Chip Pearson wrote:
*Martin,

I misread your question. To return the sheet's name back to a
cell, use the following formula

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,99)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Martin,

Where did you put the code? It should go in the worksheet's

code
module, not a regular code module or the ThisWorkbook code
module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Martín2626 " wrote

in
messag

...
Thanks but it doesn't work. When i change the sheet's name

nothing
happens in cell a1.
Other way???



Chip Pearson wrote:
*Martin,

Put the following code in the code module fo

the

worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$1" Then
Me.Name = Range("A1").Value
End If
If Err.Number < 0 Then
MsgBox "Error naming sheet: " & Err.Description
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Martín2626


wrote in
message ...
HI ALL ! I want to automatically change the name o

cell

A1
when I
change the sheet's name.
For example:
Cell A1=JANUARY
Sheet 1=JANUARY

When i write FEBRUARY I want that cell A1 = Februar

but

i
need
it to
change automatically.

TIA

MARTIN


---
Message posted from http://www.ExcelForum.com/
*


---
Message posted from http://www.ExcelForum.com/




--
Message posted from http://www.ExcelForum.com

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sheet's Name

This is what i did:
Right click on sheet1, see code and I pasted the code there.
It's Ok, isn't it??


---
Message posted from http://www.ExcelForum.com/

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Sheet's Name

Use this formula then in A1

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,255)

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Martín2626 " wrote in message ...
Thanks but it doesn't work. When i change the sheet's name nothing
happens in cell a1.
Other way???



Chip Pearson wrote:
*Martin,

Put the following code in the code module for the worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$1" Then
Me.Name = Range("A1").Value
End If
If Err.Number < 0 Then
MsgBox "Error naming sheet: " & Err.Description
End If
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Martín2626 " wrote in
message ...
HI ALL ! I want to automatically change the name of cell A1

when I
change the sheet's name.
For example:
Cell A1=JANUARY
Sheet 1=JANUARY

When i write FEBRUARY I want that cell A1 = February but i need

it to
change automatically.

TIA

MARTIN


---
Message posted from http://www.ExcelForum.com/
*



---
Message posted from http://www.ExcelForum.com/



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sheet's Name

I'm doing the same thing with the workbook I use for my budget. I am using
a simple custom formula :
Public Function SheetName(BaseCell As Range) As String
SheetName = BaseCell.Parent.Name
End Function
Put this in a module and you can use the formula in whatever cell you want.
Lauren

"Martín2626 " wrote in message
...
HI ALL ! I want to automatically change the name of cell A1 when I
change the sheet's name.
For example:
Cell A1=JANUARY
Sheet 1=JANUARY

When i write FEBRUARY I want that cell A1 = February but i need it to
change automatically.

TIA

MARTIN


---
Message posted from http://www.ExcelForum.com/



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
Possible to refer to a sheet's object name ? kittronald Excel Worksheet Functions 1 August 23rd 11 11:30 PM
Printing Sheet's Name Gingit Excel Discussion (Misc queries) 7 November 10th 08 09:13 AM
function to use sheet's name as variable tibby Excel Worksheet Functions 3 February 8th 07 05:50 PM
how to get sheet's number it's name alekm Excel Discussion (Misc queries) 2 January 30th 07 11:32 AM
Tab Name Shown In Another Sheet's Cell jbtenor1 Excel Discussion (Misc queries) 1 October 26th 05 08:52 PM


All times are GMT +1. The time now is 04:09 AM.

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

About Us

"It's about Microsoft Excel"