Vba code fill cell with special cell color

FaizanRoshan

Board Regular
Joined
Jun 11, 2015
Messages
54
Hi,
I have vba code that fill row cell with color if value is "yes" based on another cell color.
The Problem is that, i have special color for each row. but code only fill with one color, i want to fill row cell with its special color.
Code is here:

Sub Graph()
1 Column = Range("m" & Columns.Count).End(xlToRight).Column

Set MR = Range("C2:S1000" & Row)
For Each cell In MR
If cell.Value = "Yes" Then cell.Interior.ColorIndex = Range("PartsData!G20").Interior.ColorIndex


Next
End Sub

Here is Range(C2:S1000) is row and ("PartsData!G2") is color cell. where range C2:S1000 take color. There are Color Range is ("G2:G1000"). but code not take new color for new row.
Like: Row Range("C4:S4") will take "G4" color but its take "G2" color cell.
Is this possible using Vba.

Thanks Advance for all Help.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,203,643
Messages
6,056,520
Members
444,871
Latest member
Vishal Gupta

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