Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want the active worksheet to be renamed if the user changes cell G7.
The name comes from worksheet "List", cell D15 (this part works). The following code has no effect: Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Address = "$G$7" Then ActiveSheet.Name = Worksheets("List").Range("D15").Value End Sub What am I doing wrong? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom, thanks a lot! That was the problem.
How and/or where did I disable events? "Tom Ogilvy" schrieb: your original code looks fine and it worked fine for me. "Excelent's" code is functionally equivalent so I wouldn't expect it to solve your problem (but who knows). I would suggest that you have events disabled. Try running this macro Sub TurnOnEvents() Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "claudio" wrote: I want the active worksheet to be renamed if the user changes cell G7. The name comes from worksheet "List", cell D15 (this part works). The following code has no effect: Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Address = "$G$7" Then ActiveSheet.Name = Worksheets("List").Range("D15").Value End Sub What am I doing wrong? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
your original code looks fine and it worked fine for me. "Excelent's" code
is functionally equivalent so I wouldn't expect it to solve your problem (but who knows). I would suggest that you have events disabled. Try running this macro Sub TurnOnEvents() Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "claudio" wrote: I want the active worksheet to be renamed if the user changes cell G7. The name comes from worksheet "List", cell D15 (this part works). The following code has no effect: Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Address = "$G$7" Then ActiveSheet.Name = Worksheets("List").Range("D15").Value End Sub What am I doing wrong? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Unless it was a fluk, somewhere you might have the command
application.enableevents = False perhaps it is from a 3rd party addin that errored out before it reenabled them. -- regards, Tom Ogilvy "claudio" wrote: Tom, thanks a lot! That was the problem. How and/or where did I disable events? "Tom Ogilvy" schrieb: your original code looks fine and it worked fine for me. "Excelent's" code is functionally equivalent so I wouldn't expect it to solve your problem (but who knows). I would suggest that you have events disabled. Try running this macro Sub TurnOnEvents() Application.EnableEvents = True End Sub -- Regards, Tom Ogilvy "claudio" wrote: I want the active worksheet to be renamed if the user changes cell G7. The name comes from worksheet "List", cell D15 (this part works). The following code has no effect: Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Address = "$G$7" Then ActiveSheet.Name = Worksheets("List").Range("D15").Value End Sub What am I doing wrong? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Update date & time in a cell only when worksheet is changed | Excel Discussion (Misc queries) | |||
Macro in worksheet with changed name | Excel Discussion (Misc queries) | |||
Format changed when the details in cell changed | Excel Worksheet Functions | |||
cell changed - worksheet name changes | Excel Programming | |||
Sound+color alert if cell changed in another worksheet | Excel Discussion (Misc queries) |