I try to write my first macro, but when I execute it gives an error:
BASIC runtime error. A variable of type Object is not set.
The essence of the macro: delete all rows of the table except those in which there are cells with the string value s1, s2 or s3.
sub RemoveRow dim iLastRow as Long dim i as Integer dim s1, s2, s3 as String s1 = "Вход" s2 = "Выход" s3 = "Отказ" iLastRow = Cells(Rows.Count, 1).End(xlUp).Row 'ищет последнюю заполненную строку For i = 4 To lLastRow If Cells(i,5).Value = Not s1 Or Cells(i,5).Value = Not s2 Or Cells(i,5).Value = Not s3 Then Rows(i).Delete Next end sub