![]() |
cell changed - worksheet name changes
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? |
cell changed - worksheet name changes
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? |
cell changed - worksheet name changes
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? |
cell changed - worksheet name changes
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? |
All times are GMT +1. The time now is 11:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com