Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I run this macro to delete unwanted rows of data that I import into excel.
If a value in column B does not match "CR5673" the row is deleted. I now have more values that I want to include along with "CR5673". For example "DA2618" & "DA1131" do not need to be deleted. Do I write three different if statements? Also these values are dynamic. Can it compare the values in a defined named range? T.I.A. Ed Sub Step02() 'Delete rows with unwanted data Dim LastRow As Long Dim i As Long LastRow = Range("A6536").End(xlUp).Row For i = LastRow To 1 Step -1 If Not (Range("B" & i).Value Like "CR5673") Then Range("B" & i).EntireRow.Delete End If Next 'i End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need a macro to delete rows | Excel Discussion (Misc queries) | |||
My Macro Won't Delete Rows?? | New Users to Excel | |||
Delete all Rows Macro | Excel Discussion (Misc queries) | |||
delete rows using macro | Excel Worksheet Functions | |||
delete rows-macro | Excel Discussion (Misc queries) |