If Cell Color is yellow set adjacent cell to value

S

serhat

Could someone help me with the VB for this please.

I want to search column D and for each cell in column D that i
highlighted Yellow I want to set the Value of that cell to Column G i
the same row.

So if column D15 is highlighted yellow and has a value of 10 I wan
cell G15 to be set to 10.

This will save me so much time.

Thanks for your help.

S
 
D

Don Guillett

try
for each c in selection
if c.interior.colorindex=6 then c.offset(,3)=c
next
 
D

DNF Karran

First job is to find the colour index (colorindex) of the cells. WOul
suggest highlighting a yellow cell then using Range("a1").Value
Selection.Interior.ColorIndex to find what number it is.

You can then use:

Sub

Dim CurRng As Range
For Each CurRng In Range("D1:D100")
If CurRng.Interior.ColorIndex = [YELLOW] Then CurRng.Offset(0, 3).Valu
= "D"
Next

End Su
 
Top