Reefswaggie
New Member
- Joined
- Feb 13, 2015
- Messages
- 10
Hi
I want to write VB code for an excel SS that searches for fill color and then performs an action based on that.
For instance, if the fill color is red, delete the cell or empty it
I use this code for coloring my cells:
With Sheet1.Range(Cells(xx, yy), Cells(xx + 1, yy)).Interior .ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
What I want to do now is write code that says:
if sheet1.cells(xx,yy) = .colorindex 15 then
sheet1.cells(xx,yy) = "NO!"
or whatever
i just tried that particular if then statement, and i got a syntax error.
I also tried: If Sheet6.Cells(xx, yy).ColorIndex = 3 Then
and i got an object does not support property or method this error message
is there a way to state it correctly?
thanks!
I want to write VB code for an excel SS that searches for fill color and then performs an action based on that.
For instance, if the fill color is red, delete the cell or empty it
I use this code for coloring my cells:
With Sheet1.Range(Cells(xx, yy), Cells(xx + 1, yy)).Interior .ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
What I want to do now is write code that says:
if sheet1.cells(xx,yy) = .colorindex 15 then
sheet1.cells(xx,yy) = "NO!"
or whatever
i just tried that particular if then statement, and i got a syntax error.
I also tried: If Sheet6.Cells(xx, yy).ColorIndex = 3 Then
and i got an object does not support property or method this error message
is there a way to state it correctly?
thanks!