-
Solved: simple problem, please help
I have a macro that pulls the S&P500 data.
A cell will have a value like this:
"Down 9.51 (.70%)"
or
"Up 4.51 (.36%)"
I want the font color to be red if down, green if up.
[VBA]Sub changecolor()
If InStr(cells(18,10), "up") = "" Then
cells(18,10).Font.ColorIndex = 3
Else
cells(18,10).Font.ColorIndex = 4
End If
End sub[/VBA]
Thank you.
-
I have replaced[vba]InStr(cells(18,10), "up") = ""[/vba]
with[vba]InStr(1, Cells(18, 10), "up", vbTextCompare) = 0[/vba]and it works on my machine.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules