Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Color cells in Excel spreadsheet using Access?

Status
Not open for further replies.

geralf

Technical User
Apr 7, 2003
44
MX
Hi,

This question should maybe be placed under Excel, but since the code is going to be run from Access, I've placed it here.

Here's the question:

How do I color a range of cells in Excel (bacground), using a variable, and not the Range("A1") reference through the Excel Object library from Access?

Thanks in advance.



 
Have solved it. i had problems with the Range/Cells/Interior properties but found a solution. This is how I changed color in the desired spreadsheet cells:

Do While Not rst2.EOF
For I = 0 To rst2.Fields.Count - 1
CurrentField = rst2(I)
If I = 2 And rst2!VLEVERT < 0 Then
Sht.Range(.Cells(J, 4), .Cells(J, 6)).Interior.ColorIndex = 3
End If
Sht.Cells(J, I + 1).Value = CurrentField
Next I
rst2.MoveNext
J = J + 1
Loop
rst2.Close


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top