Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What is wrong? | Excel Discussion (Misc queries) | |||
Insert Calculated Field (wrong Qty*Price = wrong Amount) | Excel Discussion (Misc queries) | |||
Getting wrong value due to ref? | Excel Discussion (Misc queries) | |||
What am I doing wrong? | Excel Discussion (Misc queries) | |||
wHAT AM i DOING wrong | Excel Worksheet Functions |