HunterN
Active Member
- Joined
- Mar 19, 2002
- Messages
- 479
Hi,
I have the following code and I was wondering how to assign the row to
a variable to insert in the line Rows(4).EntireRow.Delete insted of the 4. I would like to do the below code without the selection.
I never know how to rewrite things.
Briefly, I am trying to find all the rows that have a 'D' in the ACTION column, and delete them.
NAME SIZE LOCATION ACTION
PESF1 2 191-192 N
PESG 2 193-194 D
PESZ 3 195-197 N
PESZZ 2 198-199 N
Sub Filter_Del_Out()
'* Find the rows that need to be deleted
DeleteVar = "D"
Set myFind = Columns(4).Find(what:=DeleteVar, _
After:=Range("D2"), _
LookIn:=xlValues, _
Searchorder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)
If Not myFind Is Nothing Then
myFind.Address
myFind.Select
findAddress = myFind.Address
delRow = Selection.Row
Rows(4).EntireRow.Delete
End If
End Sub
Thanks, Nancy
I have the following code and I was wondering how to assign the row to
a variable to insert in the line Rows(4).EntireRow.Delete insted of the 4. I would like to do the below code without the selection.
I never know how to rewrite things.
Briefly, I am trying to find all the rows that have a 'D' in the ACTION column, and delete them.
NAME SIZE LOCATION ACTION
PESF1 2 191-192 N
PESG 2 193-194 D
PESZ 3 195-197 N
PESZZ 2 198-199 N
Sub Filter_Del_Out()
'* Find the rows that need to be deleted
DeleteVar = "D"
Set myFind = Columns(4).Find(what:=DeleteVar, _
After:=Range("D2"), _
LookIn:=xlValues, _
Searchorder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True)
If Not myFind Is Nothing Then
myFind.Address
myFind.Select
findAddress = myFind.Address
delRow = Selection.Row
Rows(4).EntireRow.Delete
End If
End Sub
Thanks, Nancy