Error for loop

D

Daniel

Hi
I wrote a VBA to paint a color bar chart if more than 3 days.
Below is my code but it is not working, no painting,
Don't know why, need your help
Thanks
Daniel

----------------------------------------------------------------------------

Sub painting

Dim Rng7 as range
Dim Cnt7 as integer
Cnt7=1

For Each Rng7 In Range(.Cells(2, 6), .Cells(12, 6))
If Rng7.Value = "" Then
Exit For

'If IsEmpty(Rng7) Then
'not working if empty cell

Set Pts = ActiveChart.SeriesCollection(1).Points(Cnt7)

Pts.HasDataLabel = True


If (DateDiff("d", Rng7, Now)) > 3 Then

Pts.Fill.Patterned Pattern:=msoPatternDarkUpwardDiagonal

End If
Cnt7 = Cnt7 + 1

End If

Next Rng7
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top