Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11601

excel - Delete cell

$
0
0

I am new to VBA. Trying to filter one column with value starts with 42 and 48 and delete rows, but there is error message 'Application defined or object defined error'. Can anyone help on this? Tq

Sub FilterDeleteVisible()    Dim ws As Worksheet    Set ws = ThisWorkbook.Sheets("DO")     Call FilterAndDelete(ws, "E", "42*", "48*")    End SubSub FilterAndDelete(ws As Worksheet, col As String, ParamArray criteria() As Variant)    Dim rng As Range    Dim MyArray As Variant    MyArray = criteria    Set rng = ws.Range(col & ":" & col)    rng.AutoFilter Field:=1, Criteria1:=MyArray, Operator:=xlFilterValues    rng.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete    ws.AutoFilterMode = FalseEnd Sub

Viewing all articles
Browse latest Browse all 11601

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>