fmxwannabe
New Member
- Joined
- Jun 24, 2013
- Messages
- 24
Hi all,
Hoping somebody can help me why I am getting the error "wrong number ofarguments or invalid property assignment"?
' .Replace "T20", "T21", "T22","T31", "T32", "T40", "T50","T60", xlWhole'
If I change to one search condition it works, but with multiple it fails. Can somebody see where i am going wrong?
Thanks,
Hoping somebody can help me why I am getting the error "wrong number ofarguments or invalid property assignment"?
' .Replace "T20", "T21", "T22","T31", "T32", "T40", "T50","T60", xlWhole'
If I change to one search condition it works, but with multiple it fails. Can somebody see where i am going wrong?
Thanks,
Code:
Option Explicit
Sub Delete_Based_on_Criteria()
Dim lngRowStart As Long, _
lngRowEnd As Long
Dim strCol As String, _
strSheetName As String
lngRowStart = 2
strCol = "A"
strSheetName = "Sheet1"
Application.ScreenUpdating = False
With Sheets(strSheetName)
lngRowEnd = .Cells(Rows.Count, strCol).End(xlUp).Row
If lngRowEnd > lngRowStart Then
With .Range(strCol & lngRowStart & ":" & strCol & lngRowEnd)
.Replace "T20","T21","T22","T31","T32","T40","T50","T60", xlWhole
On Error Resume Next ' Account for no cells from the array being found.
.SpecialCells(xlCellTypeConstants, xlErrors).EntireRow.Delete
On Error GoTo 0
End With
End If
End With
Application.ScreenUpdating = True
End Sub