If Cell Color is yellow set adjacent cell to value

  • Thread starter Thread starter serhat
  • Start date Start date
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
 
try
for each c in selection
if c.interior.colorindex=6 then c.offset(,3)=c
next
 
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
 
Thanks a lot for your help Karan and Don. It is working like a charm :)

S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top