ColorIndex & macros

  • Thread starter Thread starter jlarkin
  • Start date Start date
J

jlarkin

Hi,

I'm looking to run a macro that references another Sheet.

If the Name, say, DAN shows up in cell C8 and the CELL color = 41
then activesheet.range(a1) colorindex = 41

if the name DAN shows up in cell C8 and the CELL color = 6
then activesheet.range(a1) colorindex = 6

and so on and so on.

But I'll be damned if I cant figure it out. I'm working on it as
side project for my boss... If anyone can help me out, that'd b
great.

-jlarkin
 
hi,
Try something like this:
If sheets("sheet2").range("c8").value = "DAN" and _
Sheets("sheet2").range("C8").interior.colorindex _
= 41 then
Activesheet.range("A1").interior.coloridex = 41
end if
Regards
Frank
 
This should work for you (change "C8", "DAN", and "A1" as needed): If,
after changing the color, they went back and changed C8 to something other
than "DAN" you could have it reset its color to default if you wanted, but I
didn't include this - let me know if you wanted this functionality also.
hth

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address(False, False) = "C8" Then
If Target.Value = "DAN" Then
ActiveSheet.Range("A1").Interior.ColorIndex =
ActiveSheet.Range("c8").Interior.ColorIndex
End If
End If
End Sub
 

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