JoanaMartins
New Member
- Joined
- Jul 14, 2016
- Messages
- 29
I continue to have a Runtime error 91 on this part of my code.
I think it is because the loop includes a with.
Can anyone help me?
Am I putting the right things in the right place?
Thank you in advance!
I think it is because the loop includes a with.
Can anyone help me?
Am I putting the right things in the right place?
Code:
Dim g As LongDim k As Long
For e = 8 To y
Set x = cs.Range("F:F").Find(fs.Cells(e, 1).Value)
If Not (x Is Nothing) Then
primeiracelula = x.Address
linha = x.Row
Do
k = Sheets("Crono").Range("E" & linha).Value - Sheets("Crono").Range("D" & linha).Value
g = fs.Range("6:6").Find(cs.Cells(linha, 4).Value).Column
With Sheets("Final").Range(Cells(e, g), Cells(e, (g + k)))
.Interior.Color = RGB(255, 153, 204)
End With
Set x = cs.Range("F:F").FindNext(x)
Loop While Not x Is Nothing And x.Address <> primeiracelula
End If
Next e
Thank you in advance!