+ Reply to Thread
Results 1 to 8 of 8

Fire Event only when Cell Change?

  1. #1
    HotRod
    Guest

    Fire Event only when Cell Change?

    I had some code that I was working with the other day that would fire an
    event only when the contents of the cell changed, any ideas? I'm currently
    using the Worksheet_SelectionChange() but it fires every time I leave a cell
    not only when the contents are changed.



  2. #2
    JulieD
    Guest

    Re: Fire Event only when Cell Change?

    Hi

    use Worksheet_Change

    check out http://www.cpearson.com/excel/events.htm for more info

    --
    Cheers
    JulieD
    check out www.hcts.net.au/tipsandtricks.htm
    ....well i'm working on it anyway
    "HotRod" <[email protected]> wrote in message
    news:ew%[email protected]...
    >I had some code that I was working with the other day that would fire an
    >event only when the contents of the cell changed, any ideas? I'm currently
    >using the Worksheet_SelectionChange() but it fires every time I leave a
    >cell not only when the contents are changed.
    >




  3. #3
    Chip Pearson
    Guest

    Re: Fire Event only when Cell Change?

    Don't use the SelectionChange event. Use the Change event.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "HotRod" <[email protected]> wrote in message
    news:ew%[email protected]...
    >I had some code that I was working with the other day that would
    >fire an event only when the contents of the cell changed, any
    >ideas? I'm currently using the Worksheet_SelectionChange() but
    >it fires every time I leave a cell not only when the contents
    >are changed.
    >




  4. #4
    HotRod
    Guest

    Re: Fire Event only when Cell Change?

    How come these EVENTS aren't listed in the drop down lists?

    By the way it was

    Sub Worksheet_Change(ByVal Target As Range)

    that I was thinking of.



  5. #5
    Tom Ogilvy
    Guest

    Re: Fire Event only when Cell Change?

    They are listed in the dropdowns for the class modules where they are
    defined.

    --
    Regards,
    Tom Ogilvy

    "HotRod" <[email protected]> wrote in message
    news:[email protected]...
    > How come these EVENTS aren't listed in the drop down lists?
    >
    > By the way it was
    >
    > Sub Worksheet_Change(ByVal Target As Range)
    >
    > that I was thinking of.
    >
    >




  6. #6
    Chip Pearson
    Guest

    Re: Fire Event only when Cell Change?

    They are listed in the drop down. Change the left drop down from
    "(General)" to "Worksheet", and the worksheet events are listed
    in the right side drop down.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "HotRod" <[email protected]> wrote in message
    news:[email protected]...
    > How come these EVENTS aren't listed in the drop down lists?
    >
    > By the way it was
    >
    > Sub Worksheet_Change(ByVal Target As Range)
    >
    > that I was thinking of.
    >




  7. #7
    HotRod
    Guest

    Re: Fire Event only when Cell Change?

    In the code when I fire the Worksheet_SelectionChange() Event I then
    reformat the contents of a cell, this in turn re-fires the Event producing
    an infinite loop. Is there something I can do, or do I need to create a
    global variable to track this problem?



  8. #8
    Tom Ogilvy
    Guest

    Re: Fire Event only when Cell Change?

    You need to learn how to program without selecting

    Instead of

    Range("A1").Select
    Selection.Numberformat = "#,##0.00"

    do

    Range("A1").Numberformat = "#,##0.00"

    no selection performed; no event triggered.

    --
    Regards.
    Tom Ogilvy

    "HotRod" <[email protected]> wrote in message
    news:[email protected]...
    > In the code when I fire the Worksheet_SelectionChange() Event I then
    > reformat the contents of a cell, this in turn re-fires the Event producing
    > an infinite loop. Is there something I can do, or do I need to create a
    > global variable to track this problem?
    >
    >




+ 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