Sub Macro1()
Dim i As Long
With ActiveSheet
.AutoFilterMode = False
i = .Range("A" & Rows.Count).End(xlUp).Row
.Range("A1:J" & i).AutoFilter
.Range("A1:J" & i).AutoFilter Field:=5, Criteria1:="<0"
.Range("A1:J" & i).Offset(1).Resize(i - 1).SpecialCells(xlCellTypeVisible).ClearContents
.AutoFilterMode = False
End With
End Sub
Sub RemCellWithNegVal()
Dim iRange As Range
On Error Resume Next
Set iRange = Application.InputBox("Select the Range", , , , , , , 8)
If iRange Is Nothing Then Exit Sub
On Error GoTo 0
iRange = Evaluate("IF(" & iRange.Address & "<0, """", " & iRange.Address & ")")
End Sub
Sub RemCellWithNegVal()
Dim iRange As Range
On Error Resume Next
Set iRange = Application.InputBox("Select the Range", , , , , , , 8)
If iRange Is Nothing Then Exit Sub
On Error GoTo 0
iRange = Evaluate("IF(" & iRange.Address & "="""","""",IF(" & iRange.Address & "<0,"""",A1:E18))")
end sub
Sub DeleteNegatives()
Range("A2:J11").Replace What:="-*", Replacement:="", LookAt:=xlWhole, SearchFormat:=False, ReplaceFormat:=False
End Sub
Possibly this?Code:Sub DeleteNegatives() Range("A2:J11").Replace What:="-*", Replacement:="", LookAt:=xlWhole, SearchFormat:=False, ReplaceFormat:=False End Sub
Which raises the issue of whether you really need a macro or could possibly just use the Find/Replace method manually?