Sub sbDelete_Rows_Based_On_Cell_Color() Dim Rng As Range Dim ws As Worksheet Dim ZadnjaKolona As Long Dim ZadnjiRed As Long Dim Celija As Range Dim I As Integer, N As Integer '*********************************************** 'avkina stara procedura samo malo prepravio '********************************************** Set ws = Application.ActiveSheet Set Celija = ws.Cells.Find(What:="*", After:=ws.Cells(1, 1), LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious, MatchCase:=False) ZadnjaKolona = Celija.Column Set Celija = ws.Cells.Find(What:="*", After:=ws.Cells(1, 1), LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, MatchCase:=False) ZadnjiRed = Celija.Row Dim a For I = 1 To ZadnjiRed For N = 1 To ZadnjaKolona If Cells(I, N).Interior.ColorIndex <> -4142 Then 'boja Rows(I).Delete End If Next N Next I End Sub