LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Deleting rows that dont...

I found some code in this forum that would delete rows if the value given
matches any of the cells on a worksheet. I was wondering how I could take
it so far as to delete any rows that arent in a list of values. for example
if i have a defined name called "forms" which reside on another page called
"DocList", any values in the rows in column D that dont match that list on
DocList, can that whole row be deleted.

niq

Sub DelRows()
Dim uRange As Range
Dim delRange As Range
Set uRange = Worksheets("CLSEXCEL").UsedRange
Set delRange = uRange.Cells(uRange.Rows.Count + 1, 1).EntireRow
For Each c In uRange.Cells
If InStr(1, c.Value, "POJORD") 0 Then
Set delRange = Union(delRange, c.EntireRow)
End If
Next c
delRange.Delete
End Sub


 
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
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Links and Linking in Excel 1 November 13th 08 08:44 AM
Macro for deleting rows and serialising the remaing rows Srinivasulu Bhattaram Excel Worksheet Functions 1 November 12th 08 01:39 PM
Locking a couple rows so when you do a delete shift row they dont palukagoat Excel Discussion (Misc queries) 3 March 22nd 05 05:25 PM
how do i delete the extra empty rows and columns that i dont need. lindaY Excel Discussion (Misc queries) 3 March 20th 05 03:48 PM
rows that dont want to be deleted!!!! cecilia12345[_11_] Excel Programming 3 December 17th 03 06:41 PM


All times are GMT +1. The time now is 09:04 AM.

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

About Us

"It's about Microsoft Excel"