View Full Version : do a loop in excel sheet from Access


bugsy
12-11-2007, 06:45 AM
hey group
How can i have something like this loop to run from ccess application which is already currently opn and where work is done ?


With objActiveWkb.Worksheets("Reconciliation Sheet")
For ii = 5 To 200
If Range(ii, 9) = "NO" Then
Range(ii + 1, 9).Interior.ColorIndex = "yellow"
End If
Next
End With

KeithG
12-11-2007, 06:49 AM
Can you expand on your question a little? I don't understand what you want to accomplish.

bugsy
12-11-2007, 07:11 AM
Hey Keith

I have query opening to excel template.
At some point 2 records right of each "no" statement are colored blue


'shading non-matching items
With objActiveWkb.Worksheets("Reconciliation Sheet").Range("b5:an500")
Set c = .Find("No", , , xlWhole, , , True)
If Not c Is Nothing Then
sAddress = c.Address
Do
c.Offset(, -2).Resize(, 3).Interior.Pattern = xlSolid
c.Offset(, -2).Resize(, 3).Interior.ColorIndex = 33
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> sAddress
End If
End With


I would also like to color yellow
left 2 cells from column I, where value is "no"