Format Range Based on Column Cell Value in VBA (Not Conditional Formatting)

  • Thread starter Thread starter Legacy 279814
  • Start date Start date
L

Legacy 279814

Guest
Hello Y'all,
I'm familiar with VBA and learning every day. I'm having a bit of trouble creating code that will look at the value in Column K and fill the cells of columns A:J a certain color based on the value in K. Here is a snippet of what I would like to have happen. This report gets e-mailed to me from our Learning Management System and therefore I can not simply use Conditional Formatting as it is a new file every day.

I would like to have items under the Code Column to dictate the color of the cells in column A through J.
The Codes and their colors I am working with are C(Blue), R(Green), X(Red), D(Purple), S(Yellow).

I've been running these reports for a couple years and just started to pick up VBA recently, but this one is throwing me for a bit of a loop. Any help would be appreciated.

Here is a simple example of what I'm working with. The real report is about 3,000 rows of entries to go through. Conditional Formatting has saved a lot of time, but if there is a way to develope a macro so I don't have to keep putting together Conditional Formatting, I would be very happy.[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[TD="align: center"]F[/TD]
[TD="align: center"]G[/TD]
[TD="align: center"]H[/TD]
[TD="align: center"]I[/TD]
[TD="align: center"]J[/TD]
[TD="align: center"]K[/TD]
[TD="align: center"]L[/TD]
[/TR]
[TR]
[TD="align: center"]Last Name[/TD]
[TD="align: center"]First Name[/TD]
[TD="align: center"]Type[/TD]
[TD="align: center"]Item ID[/TD]
[TD="align: center"]Title[/TD]
[TD="align: center"]Assigned[/TD]
[TD="align: center"]Req'd[/TD]
[TD="align: center"]Days[/TD]
[TD="align: center"]Super[/TD]
[TD="align: center"]Comment[/TD]
[TD="align: center"]Code[/TD]
[TD="align: center"]ABS?[/TD]
[/TR]
[TR]
[TD]Smith[/TD]
[TD]Bob[/TD]
[TD]OJT[/TD]
[TD]1234[/TD]
[TD]Training Doc 1[/TD]
[TD]3/23/14[/TD]
[TD]4/1/14[/TD]
[TD]2[/TD]
[TD]Stevens[/TD]
[TD]Complete[/TD]
[TD]C[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]Branson[/TD]
[TD]Steve[/TD]
[TD]TCS[/TD]
[TD]1122[/TD]
[TD]Training Doc 4[/TD]
[TD]3/24/14[/TD]
[TD]4/5/14[/TD]
[TD]6[/TD]
[TD]Stevens[/TD]
[TD]Remind[/TD]
[TD]R[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]Branson[/TD]
[TD]Steve[/TD]
[TD]TCS[/TD]
[TD]1123[/TD]
[TD]Training Doc 5[/TD]
[TD]3/24/14[/TD]
[TD]4/5/14[/TD]
[TD]6[/TD]
[TD]Johnson[/TD]
[TD]Remove[/TD]
[TD]X[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]Pepper[/TD]
[TD]Rodney[/TD]
[TD]OJT[/TD]
[TD]9849[/TD]
[TD]ERT Cert[/TD]
[TD]2/22/14[/TD]
[TD]4/22/14[/TD]
[TD]23[/TD]
[TD]Johnson[/TD]
[TD]Redate[/TD]
[TD]D[/TD]
[TD]No[/TD]
[/TR]
[TR]
[TD]Shankur[/TD]
[TD]Amiq[/TD]
[TD]TCS[/TD]
[TD]5542[/TD]
[TD]ERT Cert[/TD]
[TD]2/22/14[/TD]
[TD]4/22/14[/TD]
[TD]23[/TD]
[TD]Bradley[/TD]
[TD]Sup.Dir.[/TD]
[TD]S[/TD]
[TD]No[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,223,703
Messages
6,173,983
Members
452,540
Latest member
haasro02

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