Conditional row selection

V

Vee

I posted this before but can't find it, so here it is again.

I am trying to delete and entire row if column "A" contains "Void". Below
is the code that I have written. It wigs out when I try to select the entire
row.

Do While ActiveCell.Value <> ""
If ActiveCell.Value = "Void" Then
ActiveRow.Select
Selection.Delete Shift:=xlUp
Else
ActiveCell.Offset(1, 0).Select
End If
 
F

FSt1

hi
try this..
change..
activerow.select
selection.delete shift:=xlup

to....
Activecell.entirerow.delete shift:=xlup

truthfully, i don't think there is such a thing as activerow.

Regards
FSt1
 
M

Mike H

Hi,

Right click your sheet tab, view code and paste this in. Select you data in
column A and run the macro.

Sub merse()
For Each c In Selection
If c.Value = "Void" Then
c.EntireRow.Delete
End If
Next
End Sub

Mike
 
V

Vee

Thank You - It worked

Mike H said:
Hi,

Right click your sheet tab, view code and paste this in. Select you data in
column A and run the macro.

Sub merse()
For Each c In Selection
If c.Value = "Void" Then
c.EntireRow.Delete
End If
Next
End Sub

Mike
 
V

Vee

Thanks!

FSt1 said:
hi
try this..
change..
activerow.select
selection.delete shift:=xlup

to....
Activecell.entirerow.delete shift:=xlup

truthfully, i don't think there is such a thing as activerow.

Regards
FSt1
 
R

RyanH

I would use this. This macro will scan down column A, starting in row 2, and
anytime a cell contains "Void" it will delete that row. You can change the
Column if it doesn't fit your application.

Sub DeleteRows()

Dim lngRow As Long

' start on row 2, assume header in row 1
lngRow = 2
Do While Cells(lngRow, "A").Value <> ""
If Cells(lngRow, "A").Value = "Void" Then
Rows(lngRow).Delete Shift:=xlUp
End If
lngRow = lngRow + 1
Loop

End Sub

Hope this helps!
 
Top