Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 123
Default delete row on basic of cell

HI,

I wish to delete entire row if value in col J is "--"

I did some work but not working properly.
data id huge of 400 rows.

Thanks for help.
Boss


Sub delete()
Dim rng As Range
Dim rngAll As Range

Set rngAll = Range("j:j")

For Each rng In rngAll
If rng.Value = "--" Then

rng.EntireRow.Delete
End If
Next rng

Set rng = Nothing
Set rngAll = Nothing

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default delete row on basic of cell

Sub marine()
Set rngAll = Intersect(Range("i:j"), ActiveSheet.UsedRange)
Set rdel = Nothing
For Each r In rngAll
If r.Value = "--" Then
If rdel Is Nothing Then
Set rdel = r
Else
Set rdel = Union(rdel, r)
End If
End If
Next
If rdel Is Nothing Then
Else
rdel.EntireRow.Delete
End If
End Sub

--
Gary''s Student - gsnu200769


"Boss" wrote:

HI,

I wish to delete entire row if value in col J is "--"

I did some work but not working properly.
data id huge of 400 rows.

Thanks for help.
Boss


Sub delete()
Dim rng As Range
Dim rngAll As Range

Set rngAll = Range("j:j")

For Each rng In rngAll
If rng.Value = "--" Then

rng.EntireRow.Delete
End If
Next rng

Set rng = Nothing
Set rngAll = Nothing

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Protection and Delete Modules Jeremy Excel Discussion (Misc queries) 3 April 27th 10 02:32 PM
How to delete rows in visual basic Ruben Excel Discussion (Misc queries) 3 August 27th 08 09:43 AM
How to delete rows in visual basic Ruben Excel Discussion (Misc queries) 3 August 20th 08 03:50 PM
Delete Rows if any cell in Column H is blank but do not Delete Fir manfareed Excel Programming 4 September 28th 07 05:20 PM
Very Basic Problem - Merged Cell Equals Contents of a Single Cell jollynicechap Excel Worksheet Functions 3 December 29th 06 08:16 PM


All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"