Auto Colour based on answer key

bushidowarrior

Board Regular
Joined
Jun 27, 2011
Messages
84
Office Version
  1. 2019
Platform
  1. Windows
Hello All,

I have this table below. As you can see in the KEY column, is has the correct answer. In this case it is C.

Is there a was to make "WHAT" the correct answer highlight in GREEN?

And for the next row it would be D (They're)




i2amBDn.png



I would really appreciate it.

I have over 100 questions, hence I would like to automate this process a little.

Thank you.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Sorry, I can't figured out why.
Try copying the data as value only to a new workbook & see what happen.
 
Upvote 0
WORKING... Thank you.. I have no idea what happened. New sheet and all is working. THANK YOU VERY MUCH
 
Upvote 0
Hello,


Sorry I forgot to ask one thing.. My sincerest apologies but I think it's quite quick.


Whatever the correct answer is, which has been highlighted in green. Can I then copy that information to: J.

I am sorry I did not mention it before, it had slipped my mind...

THANK YOU VERY MUCH!!!

bfQ1igy.jpg
 
Upvote 0
Hello,


Sorry I forgot to ask one thing.. My sincerest apologies but I think it's quite quick.


Whatever the correct answer is, which has been highlighted in green. Can I then copy that information to: J.

I am sorry I did not mention it before, it had slipped my mind...

THANK YOU VERY MUCH!!!

OK, try this:
And this revised code also should take care the trailing space problem so you don't have to worry about that.

Code:
Sub a1075737b()
'https://www.mrexcel.com/forum/excel-questions/1075737-auto-colour-based-answer-key.html
Dim r As Range, s As String
For Each r In Range("E2", Cells(Rows.count, "E").End(xlUp))
s = Trim(r)
If s Like "[A-D]" Then
Range(s & r.row).Offset(0, 5).Interior.Color = vbGreen
Range("J" & r.row) = Range(s & r.row).Offset(0, 5)
End If
Next
 
Upvote 0
Absolutely fantastic.. Works perfectly and thank you for taking care of the training spaces..


I owe you a few beers... Whatever you want
 
Upvote 0
Absolutely fantastic.. Works perfectly and thank you for taking care of the training spaces..


I owe you a few beers... Whatever you want

Hahaha, thank you, but beer is hard to sent... but bitcoin isn't...:laugh: ...kidding.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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