ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Rows (https://www.excelbanter.com/excel-programming/295864-delete-rows.html)

Sandman[_2_]

Delete Rows
 
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:



Chris

Delete Rows
 
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:




Gord Dibben

Delete Rows
 
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


On Wed, 21 Apr 2004 16:01:35 -0500, "Sandman" wrote:

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


Thanks




All times are GMT +1. The time now is 11:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com