Run code when cell value changes

  • Re: Watch cell?







    I forggot to insert line in Sub SORT Hights to trigger Sheet("STICKandTEMP") PrivateSubWorksheet_Change event :(

  • Re: Watch cell?


    I mentioned in a few previous posts how to trigger the macro. Here is how to change the cell color (format) your cells:


    Code
    Sub ColorMyCell()
    
    
    
    
        Range("R1").Interior.Color = 65535 'Yellow
        Range("S1").Interior.Color = 255 'Red
        Range("T1").Interior.Color = 5287936 'Green
      
    End Sub

    Matt Mickle
    Using Excel 2010,2013 & 2016

  • Re: Watch cell?


    If you want the change event to be triggered in the sheet then leave it, If not then you should turn the event code into a regular macro and then call it from the sort procedure.




    You could also do both....if you want to trigger the change event code you will need to change a cells value like I mentioned:


    Code
    Sub Test() 
         
        'Your Sort Code Here
      
        Sheets("Sheet1").Range("Z1") = "Trigger" ' By putting the value "Trigger" in a cell on the worksheet you have that contains the change event
                                                                  'This will trigger the change event code.....because the worksheet has been changed....
         
    End Sub


    More info on the Worksheet Change Event: https://msdn.microsoft.com/en-…255&MSPPError=-2147217396

    Matt Mickle
    Using Excel 2010,2013 & 2016

  • Re: Watch cell?


    It's working, for now, but, when i change value in B8 on sheet STICKandTEMP to let's say 155 of something, then i save workbook. After i open workbook tomorow, i get value on sheet HEIGHTS like 01-02:33, one day 2 hours 33 mins. But, after few minutes i run Sort code with that "Trigger" inside, and i still getting 01-02:33 ??? :(




    It is not working. Cannot use "Trigger", i need check every cell for changes :

    Code
    Range("B8").Select 
        ActiveCell.FormulaR1C1 = Target.Value


    but, this is not working, i get runtime error.
    And every time i open workbook, some values are zeroes 00-00:00?

  • Re: Watch cell?




    Bump?

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!