Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() 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
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
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 |