What is wrong?

R

robert morris

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.
 
R

robert morris

Duh??

I feel "blonde".

Thanks Max

Bob M.



Max said:
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
 
P

Per Jessen

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.
 
R

robert morris

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top