hello
i'm using code based on Ron de Bruin's site
I want to delete row/s if a specific value exist on either 2 columns
Basically, I want to delete value 1 or 2 on column "A"
and "955.46*" on column "D"
i'm getting run time error '424' what I'm doing wrong??
(line "If Not IsError(.Value) Then" highlighted)
Thanks
Eitan
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">[TABLE="width: 800"]
<tbody>[TR]
[TD][h=1]Ron de Bruin[/h][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 800"]
<tbody>[TR]
[TD][h=1]Ron de Bruin[/h][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 800"]
<tbody>[TR]
[TD][h=1]Ron de Bruin[/h][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 800"]
<tbody>[TR]
[TD][h=1]Ron de Bruin[/h][/TD]
[/TR]
</tbody>[/TABLE]
</body>
i'm using code based on Ron de Bruin's site
I want to delete row/s if a specific value exist on either 2 columns
Basically, I want to delete value 1 or 2 on column "A"
and "955.46*" on column "D"
i'm getting run time error '424' what I'm doing wrong??
(line "If Not IsError(.Value) Then" highlighted)
Code:
Sub delete0()
Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
Dim ViewMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
'We use the ActiveSheet but you can replace this with
'Sheets("MySheet")if you want
With ActiveSheet
'We select the sheet so we can change the window view
.Select
'If you are in Page Break Preview Or Page Layout view go
'back to normal view, we do this for speed
ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
'Turn off Page Breaks, we do this for speed
.DisplayPageBreaks = False
'Set the first and last row to loop through
Firstrow = .UsedRange.Cells(1).Row
Lastrow = .UsedRange.Rows(.UsedRange.Rows.Count).Row
'We loop from Lastrow to Firstrow (bottom to top)
For Lrow = Lastrow To Firstrow Step -1
'We check the values in the A column in this example
With .Cells(Lrow, "A") And .Cells(Lrow, "D")
If Not IsError(.Value) Then
If .Value = "1" Or "2" Or Value Like "955.46*" Then .EntireRow.Delete
End If
End With
Next Lrow
End With
ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub
Thanks
Eitan
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">[TABLE="width: 800"]
<tbody>[TR]
[TD][h=1]Ron de Bruin[/h][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 800"]
<tbody>[TR]
[TD][h=1]Ron de Bruin[/h][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 800"]
<tbody>[TR]
[TD][h=1]Ron de Bruin[/h][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 800"]
<tbody>[TR]
[TD][h=1]Ron de Bruin[/h][/TD]
[/TR]
</tbody>[/TABLE]
</body>