Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro for deleting rows and serialising the remaing rows | Links and Linking in Excel | |||
Macro for deleting rows and serialising the remaing rows | Excel Worksheet Functions | |||
Locking a couple rows so when you do a delete shift row they dont | Excel Discussion (Misc queries) | |||
how do i delete the extra empty rows and columns that i dont need. | Excel Discussion (Misc queries) | |||
rows that dont want to be deleted!!!! | Excel Programming |