jeudi 1 octobre 2020

Loop through all my sheets and if an interior condition is met then copy this to my controle worksheet

My code works perfectly without looping through all the worksheets. I really dont know what I am doing wrong. Can someone please help me with this one? The purpose is that I have a list in my sheet "controle" with all the collared cells from all the worksheets.

Sub Dubbelewaarden()
Dim cell As Range
Dim sht As Worksheet
For Each sht In Worksheets
If Not sht.Name <> "Controle" Then
    For Each cell In Range("A2", Range("A2").End(xlDown))
        If cell.Interior.ColorIndex = 3 Then
        cell.EntireRow.Copy Destination:=Sheets("Controle").Range("A" & Rows.Count).End(xlUp).Offset(1)
        End If
    Next cell
End If
Next sht

End Sub
```
Thanks Already

Aucun commentaire:

Enregistrer un commentaire