Closed Thread
Results 1 to 3 of 3

Compare Cell.ID to Cell.Value not working for numbers

Hybrid View

  1. #1
    Registered User
    Join Date
    03-07-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    55

    Compare Cell.ID to Cell.Value not working for numbers

    I have the following function 'Trigger' in Excel. It watches a range A1:A10 for any changes to the cell values so =Trigger(A1:A10).

    Works great if the cell values are text, ie. YES or NO, if I make a change to one cell in this range it only displays the msgbox with that particular cell address which is what I want.

    BUT... I need the range to be numbers, i.e. 10.47. If I make the range numbers and change one cell value the function displays a msgbox for each cell address in the range even though only one cell value has changed. Please help! Appreciation in advance.

    Function Trigger(ByVal rEntireRange As Range) As Date
        For Each rCell In rEntireRange
            If (Not IsEmpty(rCell)) And (Not IsError(rCell)) And (rCell.ID <> rCell.Value) Then
                MsgBox rCell.Address & " is changed"
                rCell.ID = rCell.Value
            End If
        Next rCell
        Trigger = Now
    End Function

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,941

    Re: Compare Cell.ID to Cell.Value not working for numbers

    I might be missing something, but what you are asking for is exactly what the Worksheet Change event is for.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,941

    Re: Compare Cell.ID to Cell.Value not working for numbers

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.

Closed Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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