PC Review


Reply
Thread Tools Rate Thread

delete row on basic of cell

 
 
Boss
Guest
Posts: n/a
 
      14th Feb 2008
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 With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      14th Feb 2008
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you delete a cell without going Table>Select>Cell then Table>Delete>Cell - phew! JethroUK© Microsoft Frontpage 3 8th Jun 2009 10:58 PM
Re: Very Basic Problem - Merged Cell Equals Contents of a Single Cell Dave Peterson Microsoft Excel Worksheet Functions 0 29th Dec 2006 07:37 PM
Re: Very Basic Problem - Merged Cell Equals Contents of a Single Cell T. Valko Microsoft Excel Worksheet Functions 0 29th Dec 2006 07:35 PM
basic delete of a subset =?Utf-8?B?Qm9yaXNT?= Microsoft Access 0 17th Dec 2005 02:18 AM
RE: basic delete of a subset =?Utf-8?B?Sm9obiBWaW5zb24=?= Microsoft Access 0 17th Dec 2005 02:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:06 PM.