Untitled
unknown
plain_text
2 years ago
1.0 kB
21
Indexable
Sub UsunWierszeZielonegoTla()
Dim arkusz As Worksheet
Dim wiersz As Range
Dim komorka As Range
Dim doUsuniecia As Range
' Przejście przez każdy arkusz w skoroszycie
For Each arkusz In ThisWorkbook.Sheets
Set doUsuniecia = Nothing
' Przejście przez każdy wiersz w arkuszu
For Each wiersz In arkusz.UsedRange.Rows
For Each komorka In wiersz.Cells
' Sprawdzenie, czy tło komórki jest zielone
If komorka.Interior.Color = RGB(0, 255, 0) Then
If doUsuniecia Is Nothing Then
Set doUsuniecia = wiersz
Else
Set doUsuniecia = Union(doUsuniecia, wiersz)
End If
Exit For
End If
Next komorka
Next wiersz
' Usunięcie wszystkich wierszy z zielonym tłem
If Not doUsuniecia Is Nothing Then doUsuniecia.EntireRow.Delete
Next arkusz
End SubEditor is loading...