+ Reply to Thread
Results 1 to 4 of 4

cell changed -> worksheet name changes

  1. #1
    claudio
    Guest

    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?

  2. #2
    claudio
    Guest

    RE: 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?


  3. #3
    Tom Ogilvy
    Guest

    RE: 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?


  4. #4
    Tom Ogilvy
    Guest

    RE: 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?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1