I have modified the code more precisely. Use it in your actual source code. Before that refer to it and make some minor changes as per your code. This code is from a webpage with success.
Code:
Dim DeleteValue As String
Dim rng As Range
DeleteValue = ("Randomizer!d3")
' This will delete the rows with "ron" in the Range("A1:A100")
With ActiveSheet
Sheet9.Range("A1:A100").AutoFilter Field:=1, Criteria1:=DeleteValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Delete
End With
.AutoFilterMode = False
End With
Bookmarks