+ Reply to Thread
Results 1 to 6 of 6

compare old value and change background colour of a DDE link and calculated cell

  1. #1
    Registered User
    Join Date
    12-20-2011
    Location
    Rajkot, India
    MS-Off Ver
    Excel 2010
    Posts
    12

    Exclamation compare old value and change background colour of a DDE link and calculated cell

    Hi,

    I have a excel sheet (EXCEL 2013)with calculated fields from input of DDE data and SQL table data (refreshed query every Second)

    I want to compare the old value in cell and if higher then current value cell background should be GREEN and if lower then cell background RED.

    Sheet1:

    B2 is =AMR|Bid+Sheet2!B2
    B3 is = AMR|ASK+Sheet2!B3
    D2 is =AMR|GB+Sheet2!G4
    D3 is =AMR|US+Sheet2!H10

    Sheet 2 gets data from SQL table.

    then I want to change corresponding cell background to GREEN if lower then old value if the same cell and RED if higher then old Value of the same cell.

    I have a timer in module to refresh SQL data every second fetched data is stored in Sheet2.

    Please Login or Register  to view this content.
    Please help, I have tried multiple solutions but in vain as there is no user entry being done only DDE data and SQL Data.
    Last edited by gpatel; 03-03-2015 at 02:06 AM. Reason: more precise title

  2. #2
    Registered User
    Join Date
    12-20-2011
    Location
    Rajkot, India
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: DDE input and SQL table input compare cell vaule with old value and colour cell bkgnd

    Any help please.

  3. #3
    Registered User
    Join Date
    03-03-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    7

    Re: DDE input and SQL table input compare cell vaule with old value and colour cell bkgnd

    Just copy and paste values from the old data over to another sheet, or hidden cells on the same sheet, right before you call for the new data and then run another macro right after the request for new data comes in to compare the values. Or am I not fully understanding your question?

  4. #4
    Registered User
    Join Date
    12-20-2011
    Location
    Rajkot, India
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: DDE input and SQL table input compare cell vaule with old value and colour cell bkgnd

    i did the code as below and working fine but with two problems

    1. It is Slow
    2. It is not working when the Sheet is locked (we have to keep it locked so that the formulas are not changed)

    Please Login or Register  to view this content.
    can you update it

  5. #5
    Registered User
    Join Date
    03-03-2015
    Location
    Denver, CO
    MS-Off Ver
    2013
    Posts
    7

    Re: DDE input and SQL table input compare cell vaule with old value and colour cell bkgnd

    As far as your two problems go:

    1) I'm not sure that application.intersect is a quick method to use. If you can come up with something better is might be a good idea. Without an example worksheet to look at I'm a bit in the dark on what is really going on in your worksheet.

    2) When you protect the sheet, you need to check the box that says allow users to format cells. You cannot change cell colors in a protected worksheet/workbook unless you check that box. It's the box right under the first two that are selected by default.

    Hope that helps!

  6. #6
    Registered User
    Join Date
    12-20-2011
    Location
    Rajkot, India
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: DDE input and SQL table input compare cell vaule with old value and colour cell bkgnd

    Attached is the sheet for reference


    and thank you for second solution of locking the sheet. I didn't know that macro can change formatting with that checkbox.

    But ran into one problem while locking sheet with formatting on. the DDE Links cannot update itself. (check the code in Module sub con refresh with comment Update other link values - V6), any suggestion.
    Attached Files Attached Files
    Last edited by gpatel; 03-04-2015 at 03:16 AM. Reason: quick update of result

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Changing the cell colour based on what is input in another cell.
    By MissMay in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-21-2013, 10:21 AM
  2. Making cell changed colour, on input.
    By mikeuk1954 in forum Excel General
    Replies: 7
    Last Post: 05-10-2013, 07:38 AM
  3. Cell change colour due to what i input
    By Sheepkin_Coat in forum Excel General
    Replies: 2
    Last Post: 03-31-2013, 08:48 AM
  4. Replies: 2
    Last Post: 10-08-2012, 08:10 AM
  5. Input Cell to create table with input # of rows
    By pgreenway in forum Excel General
    Replies: 3
    Last Post: 05-04-2011, 03:18 PM

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