Thread: [Solved] Deleting rows
View Single Post
 
Old 03-14-2022, 04:09 PM
rollis13's Avatar
rollis13 rollis13 is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 143
rollis13 will become famous soon enough
Default

Have a try with this macro:
Code:
Option Explicit
Sub EliminaRigheConArray()
    Dim mioArr As Variant
    Dim y      As Long
    Application.ScreenUpdating = False
    mioArr = Array("", "Dal dip", "X   Dat", "4432  A", "VIA PRI", "20154", "339075")
    With ActiveSheet
        For y = LBound(mioArr) To UBound(mioArr)
            .AutoFilterMode = False
            With Range("A28", Range("A" & Rows.Count).End(xlUp))
                .AutoFilter 1, mioArr(y)
                On Error Resume Next
                If mioArr(y) = "" Then
                    .Offset(1).SpecialCells(4).EntireRow.Delete 'xlCellTypeBlanks
                Else
                    .Offset(1).SpecialCells(12).EntireRow.Delete 'xlCellTypeVisible
                End If
            End With
        Next y
        .AutoFilterMode = False
    End With
    Application.ScreenUpdating = True
    MsgBox "Done!"
End Sub
Reply With Quote