I'm populating a spreadsheet with an SQL recordset through VB code
(v6.0).
I need to HIGHLIGHT a cell if it meets certain criteria.
I need to know (and trust me, I've looked all over the net/MSDN
library for this) what the cell property is called that allows me to
change the background color of the current cell of my [Excel.Object]
I've tried various code samples that I have found and most of them
return error 13, type mismatch or Invalid Qualifier.
Is this truly difficult or am I missing something?
I am able to make the font bold. I could also probably make the text
color something else, but I really just want to highlight the cell.
Thanks in advance.
Tim Hansen
Mark Scott [MSFT] - 31 Oct 2003 21:56 GMT
Tim,
You might want to try using code that resembles the following:
Private Sub CommandButton1_Click()
Dim i As String
i = "1"
If Sheets(1).Cells(2, 1).Value > 1 Then
Range("A" & i).Select
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
End If
End Sub
Best Regards,
Mark D. Scott, Microsoft
Please do not send email directly to this alias. This is my online account
name for newsgroup participation only. This posting is provided "As is"
with no warranties, and confers no rights.
> I'm populating a spreadsheet with an SQL recordset through VB code
> (v6.0).
[quoted text clipped - 9 lines]
> Thanks in advance.
> Tim Hansen