Button Press for Condtional Formatting Based on Cell Values

Caelus

New Member
Joined
Jul 29, 2014
Messages
6
Good day,

I'm using Excel 2010 and creating what is essentially a study tool - a comparison between two lists (one that the user populates and the one beside it which has the answers). There are three columns in each list but there are merged cells that serve as headers for each sub-section.

I have figured out macro recording, button creation, and assigning macros to buttons. I have also noticed that I can record macros involving conditional formatting. What I cannot figure out how to do is this:

I would like the user to be able to enter a bunch of data in the first field (three columns) and then click a button to "validate" the entered data. If the data matches the field that contains the answers, I would like the user's data boxes to turn green in each correct instance. I do not want the boxes to turn green until the button press. I would also like the option of reverting the cells back to normal (clear the green fill).

In a more advanced version, I would like yellow boxes for user-entered data which is correct in lettering but perhaps not exact in formatting (capitals or lower case).
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Caelus,

Welcome to MrExcel.

Are you looking to have just one button that toggles validation/ CF'ing for the the whole range of answers ?
 
Upvote 0
Yes, but I'm open to other solutions. Ideally the user would simply enter all their data and just hit one button to reveal all those cells which are "correct" in relation to the field with the answers.
 
Upvote 0
Here is a suggestion that will not require vba.

Instead of a button you can insert a checkbox, (or an option button).
Right click the checkbox >> Format Control >> Control tab and set the linked cell.

In the below example I1 is the linked cell.
The value of this cell will toggle between TRUE and FALSE with the checkbox.

Then apply standard conditional formatting similar to the below to check the student answers against the required answers and the state of I1.
Excel Workbook
ABCDEFGHI
1Student AnswersCorrect AnswersValidationTRUE
2Section 1
3ANSWER1b1C1Answer1B1C1
4A2B2C5A2B2C2
5A3B3RubbishA3B3C3
6A6b6c4A4B4C4
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A31. / Formula is =AND($I$1=TRUE,EXACT(A3,E3))Abc
A32. / Formula is =AND($I$1=TRUE,A3=E3)Abc


Hope that helps.


 
Upvote 0
Ok, I'm back. Sorry for the delay.

Your suggested solution worked perfectly when I figured out that you had ordered the rules that way for a reason! Thanks for the quick and effective reply!
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top