#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 222
Default What is wrong?



I use this VBA Code to change the Tab name at the same time as I enter a
name in Cell B2. Why doesn't it work? I use the same code in another
Workbook and it works.


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Address = "$B$2" Then Sh.Name = Target.Value
End Sub



Any ideas?

Bob M.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 222
Default What is wrong?


Duh??

I feel "blonde".

Thanks Max

Bob M.



"Max" wrote:

Works fine in testing here,
provided B2 contains a valid sheetname (w/o prohibited chars)

In VBE, did you install it in "ThisWorkbook"?
It's meant to be placed there.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:22,500 Files:370 Subscribers:66
xdemechanik
---
"robert morris" wrote:
I use this VBA Code to change the Tab name at the same time as I enter a
name in Cell B2. Why doesn't it work? I use the same code in another
Workbook and it works.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Address = "$B$2" Then Sh.Name = Target.Value
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default What is wrong?

No prob, Bob. Happens to me, too.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:23,000 Files:370 Subscribers:66
xdemechanik
---
"robert morris" wrote in message
...

Duh??

I feel "blonde".

Thanks Max

Bob M.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,533
Default What is wrong?

Hi Bob

My guess is that you haven't put the macro into the right place.

As it is a workbook event code it has to be in the code sheet for
ThisWorkbook.

Hopes this helps.

---
Per

"robert morris" skrev i meddelelsen
...


I use this VBA Code to change the Tab name at the same time as I enter a
name in Cell B2. Why doesn't it work? I use the same code in another
Workbook and it works.


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Address = "$B$2" Then Sh.Name = Target.Value
End Sub



Any ideas?

Bob M.


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 222
Default What is wrong?

Per,

You and Max were both correct! I did not have the code in ThisWorkbook.
Sometimes "the trees and the forest" comes to play.

Many Thanks

Bob



"Per Jessen" wrote:

Hi Bob

My guess is that you haven't put the macro into the right place.

As it is a workbook event code it has to be in the code sheet for
ThisWorkbook.

Hopes this helps.

---
Per

"robert morris" skrev i meddelelsen
...


I use this VBA Code to change the Tab name at the same time as I enter a
name in Cell B2. Why doesn't it work? I use the same code in another
Workbook and it works.


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Address = "$B$2" Then Sh.Name = Target.Value
End Sub



Any ideas?

Bob M.





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 703
Default What is wrong?

Bob,

I'm glad that you found your way through the forrest :-)

Regards,
Per

On 6 Feb., 02:54, robert morris
wrote:
Per,

You and Max were both correct! *I did not have the code in ThisWorkbook.. *
Sometimes "the trees and the forest" comes to play.

Many Thanks

Bob



"Per Jessen" wrote:
Hi Bob


My guess is that you haven't put the *macro into the right place.


As it is a workbook event code it has to be in the code sheet for
ThisWorkbook.


Hopes this helps.


---
Per


"robert morris" skrev i meddelelsen
...


I use this VBA Code to change the Tab name at the same time as I enter a
name in Cell B2. *Why doesn't it work? *I use the same code in another
Workbook and it works.


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Address = "$B$2" Then Sh.Name = Target.Value
End Sub


Any ideas?


Bob M.- Skjul tekst i anførselstegn -


- Vis tekst i anførselstegn -


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
What is wrong? Max Excel Discussion (Misc queries) 0 February 5th 09 02:40 AM
Insert Calculated Field (wrong Qty*Price = wrong Amount) Edmund Excel Discussion (Misc queries) 8 October 4th 07 12:13 PM
Getting wrong value due to ref? jesmin Excel Discussion (Misc queries) 2 March 16th 06 02:12 AM
What am I doing wrong? PFB1033 Excel Discussion (Misc queries) 1 February 13th 06 02:13 AM
wHAT AM i DOING wrong DMB Excel Worksheet Functions 3 December 27th 05 05:41 PM


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

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"