+ Reply to Thread
Results 1 to 9 of 9

Compare two Columns and Highlight

  1. #1
    Registered User
    Join Date
    07-03-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    5

    Compare two Columns and Highlight

    Been working on this for a while with too many hours of googling.

    So basically, this is a quiz that's being made, Column O has a drop down menu for A, B, C or D (for the answer to the question) and Column Q has the answer.

    What I am trying to do is whoever takes the quiz has to answer all 100 questions and then can click the Score button, I need it to highlight the correct answers Green and the Wrong answers Red.

    So if O3 through O102 has the same answer as Q3 through Q102, highlight green, else highlight red. Closest I can get is it works once but anytime I use the drop down and select an answer, it highlights red or green.

  2. #2
    Registered User
    Join Date
    06-18-2015
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    13

    Re: Compare two Columns and Highlight

    Hello,

    could you provide a file with one question and the 'Score' button?

  3. #3
    Registered User
    Join Date
    07-03-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    5

    Re: Compare two Columns and Highlight

    As much as I can, had to take a lot out because of the questions that would be in it.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-18-2015
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    13

    Re: Compare two Columns and Highlight

    I understand.
    As I see you do not use macros to calculate correct and wrong values at button_click but excel formulas.
    So, could you try to set formula calculation setting to Manual. The setting located under Formulas tab -> Calculation Options.
    Then try again.

    You may need to calculate entire workbook at the beginning.
    Please Login or Register  to view this content.
    Last edited by theoxskyl; 07-04-2015 at 07:02 AM. Reason: misspelling

  5. #5
    Registered User
    Join Date
    07-03-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    5

    Re: Compare two Columns and Highlight

    I want the commandbutton be the button that needs to be clicked to calculate. The calculation is already set to manual. I'm not sure where the two ActiveWorkbook needs to go

  6. #6
    Registered User
    Join Date
    06-18-2015
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    13

    Re: Compare two Columns and Highlight

    Ok. Something probably went wrong with security settings and the calculation was Automatic when I opened the workbook.
    The two ActiveWorkbook are just in case something is not calculated correctly before the beginning of the test.

    Why don't you call ConditionalFormat function at CommandButton22_Click.
    Also, why do you use Application.Volatile in ConditionalFormat function? This makes the ConditionalFormat function to be called every time recalculation occurs.

  7. #7
    Registered User
    Join Date
    07-03-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    5

    Re: Compare two Columns and Highlight

    I didn't build this whole thing. Just trying to help out on getting the CommandButton to work. I'm really not that well versed in VBA so I am mostly winging it.

  8. #8
    Registered User
    Join Date
    06-18-2015
    Location
    Greece
    MS-Off Ver
    2013
    Posts
    13

    Re: Compare two Columns and Highlight

    OK. Open the macros window and change the code as below in Sheet2(Test)

    Please Login or Register  to view this content.
    Try the quiz again

  9. #9
    Registered User
    Join Date
    07-03-2015
    Location
    USA
    MS-Off Ver
    2013
    Posts
    5

    Re: Compare two Columns and Highlight

    That works a lot better than before, thanks. Now another things I'm trying to figure out using your code, when I select, say A from the drop down for an answer, it will highlight the cell red or green if it is right or wrong. How do I go about keeping the cell clear until the Score button is clicked?

    Nevermind, added the .ClearContents and a call for clearConditionalFormatting. That clears the cells needed.

    Also added:

    Please Login or Register  to view this content.
    So now it looks like:

    Please Login or Register  to view this content.
    So far this is doing everything I need, keeps empty cells white, correct answers green and wrong answers red. Thank you for all of your help.
    Last edited by Overclocker16; 07-04-2015 at 04:40 PM.

+ 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. compare columns and highlight
    By Goodstart14 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-05-2015, 12:45 PM
  2. Compare/Highlight Two Columns
    By mikayluh in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-26-2015, 03:33 PM
  3. Compare Columns and Highlight
    By lkurrt in forum Excel General
    Replies: 2
    Last Post: 09-19-2013, 02:21 PM
  4. Compare 2 columns and highlight the new value,
    By fpolaco in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2012, 02:22 PM
  5. Replies: 2
    Last Post: 01-26-2012, 12:04 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