Delete Rows

S

Sandman

Is there a simple Code to delete a row that contains the symbol "-" in a
cell?


Thanks

--





Darrin Sand
Project Manager
MEC Services Inc
Phone: 701-337-5404
Cell: 701-240-4000
email: (e-mail address removed)
 
G

Guest

try this

'With a static value
Sub Public RemoveRow(
D
Set x = Cells.Find("-"
If x Is Nothing Then Exit Su
Range(x.Address).EntireRow.Delet
Loo
End Su

'with a variable
Sub Public RemoveRow(Val as String
D
Set x = Cells.Find(Val
If x Is Nothing Then Exit Su
Range(x.Address).EntireRow.Delet
Loo
End Su


----- Sandman wrote: ----

Is there a simple Code to delete a row that contains the symbol "-" in
cell


Thank

--





Darrin San
Project Manage
MEC Services In
Phone: 701-337-540
Cell: 701-240-400
email: (e-mail address removed)
 
G

Gord Dibben

Sandman

Just the symbol "-" or in combination with other stuff like -12?

Sub delete_rows()
Dim c As Range
With Columns("A")
Do
Set c = .Find("-", LookIn:=xlValues, LookAt:=xlPart, _
MatchCase:=False)
'change xlPart to xlWhole if just looking for "-" alone
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop
End With
End Sub

Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top