[B][color=Royalblue]Sub[/color][/B] a1075737c()
[i][color=seagreen]'https://www.mrexcel.com/forum/excel-questions/1075737-auto-colour-based-answer-key.html[/color][/i]
[B][color=Royalblue]Dim[/color][/B] r [B][color=Royalblue]As[/color][/B] Range, s [B][color=Royalblue]As[/color][/B] [B][color=Royalblue]String[/color][/B]
[B][color=Royalblue]Dim[/color][/B] i [B][color=Royalblue]As[/color][/B] [B][color=Royalblue]Long[/color][/B], j [B][color=Royalblue]As[/color][/B] [B][color=Royalblue]Long[/color][/B], x [B][color=Royalblue]As[/color][/B] [B][color=Royalblue]Long[/color][/B]
[B][color=Royalblue]Dim[/color][/B] va, vb, ac
Application.ScreenUpdating = [B][color=Royalblue]False[/color][/B]
Range([color=brown]"F3:I"[/color] & Cells(Rows.count, [color=brown]"E"[/color]).[B][color=Royalblue]End[/color][/B](xlUp).row).Interior.Color = xlNone
[B][color=Royalblue]For[/color][/B] [B][color=Royalblue]Each[/color][/B] r [B][color=Royalblue]In[/color][/B] Range([color=brown]"E3"[/color], Cells(Rows.count, [color=brown]"E"[/color]).[B][color=Royalblue]End[/color][/B](xlUp))
s = Trim(r)
[B][color=Royalblue]If[/color][/B] s [B][color=Royalblue]Like[/color][/B] [color=brown]"[A-D]"[/color] [B][color=Royalblue]Then[/color][/B]
x = r.row
Range(s & x).Offset([color=crimson]0[/color], [color=crimson]5[/color]).Interior.Color = vbGreen
Range([color=brown]"K"[/color] & x) = Range(s & x).Offset([color=crimson]0[/color], [color=crimson]5[/color])
va = Range(Cells(x, [color=brown]"F"[/color]), Cells(x + [color=crimson]1[/color], [color=brown]"I"[/color]))
[B][color=Royalblue]ReDim[/color][/B] vb([color=crimson]1[/color] [B][color=Royalblue]To[/color][/B] [color=crimson]1[/color], [color=crimson]1[/color] [B][color=Royalblue]To[/color][/B] UBound(va, [color=crimson]2[/color]))
ac = Split([color=brown]"A,B,C,D"[/color], [color=brown]","[/color])
[B][color=Royalblue]For[/color][/B] i = [color=crimson]1[/color] [B][color=Royalblue]To[/color][/B] UBound(va, [color=crimson]2[/color])
va([color=crimson]2[/color], i) = ac(i - [color=crimson]1[/color])
[B][color=Royalblue]Next[/color][/B]
j = [color=crimson]2[/color]
[B][color=Royalblue]For[/color][/B] i = [color=crimson]1[/color] [B][color=Royalblue]To[/color][/B] UBound(vb, [color=crimson]2[/color])
[B][color=Royalblue]If[/color][/B] s = ac(i - [color=crimson]1[/color]) [B][color=Royalblue]Then[/color][/B]
vb([color=crimson]1[/color], [color=crimson]1[/color]) = va([color=crimson]1[/color], i)
[B][color=Royalblue]Else[/color][/B]
vb([color=crimson]1[/color], j) = va([color=crimson]1[/color], i)
j = j + [color=crimson]1[/color]
[B][color=Royalblue]End[/color][/B] [B][color=Royalblue]If[/color][/B]
[B][color=Royalblue]Next[/color][/B]
Range([color=brown]"K"[/color] & x).Resize([color=crimson]1[/color], [color=crimson]4[/color]) = vb
[B][color=Royalblue]End[/color][/B] [B][color=Royalblue]If[/color][/B]
[B][color=Royalblue]Next[/color][/B]
Application.ScreenUpdating = [B][color=Royalblue]True[/color][/B]
[B][color=Royalblue]End[/color][/B] [B][color=Royalblue]Sub[/color][/B]