Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I import data for an external source into Excel. I sort and format the data
programatically. This data contains some information that I need to delete. Searching that range by using the following: Columns("A:A").Find(What:="74RM",... ).Activate How do I delete the entire row when the search criteria is found? I'm also having difficulty understanding how to trap the error that occurs when the search critieria is not found. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will go thru all the cells in column A, find the cells containing the
string "74RM" and delete the entire row. If non are found, no rows are deleted: Sub posse() Dim lastrow As Long lastrow = Cells(Rows.Count, "A").End(xlUp).Row For i = lastrow To 1 Step -1 If InStr(Cells(i, "A").Value, "74RM") 0 Then Cells(i, "A").EntireRow.Delete End If Next End Sub -- Gary's Student gsnu200707 "Posse John" wrote: I import data for an external source into Excel. I sort and format the data programatically. This data contains some information that I need to delete. Searching that range by using the following: Columns("A:A").Find(What:="74RM",... ).Activate How do I delete the entire row when the search criteria is found? I'm also having difficulty understanding how to trap the error that occurs when the search critieria is not found. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() set rng = Columns("A:A").Find(What:="74RM",... ) if not rng is nothing then rng.EntireRow.Delete End if -- Regards, Tom Ogilvy "Posse John" wrote: I import data for an external source into Excel. I sort and format the data programatically. This data contains some information that I need to delete. Searching that range by using the following: Columns("A:A").Find(What:="74RM",... ).Activate How do I delete the entire row when the search criteria is found? I'm also having difficulty understanding how to trap the error that occurs when the search critieria is not found. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Match with 2 Lookup_Values used as search criteria. | Excel Worksheet Functions | |||
Match with 2 Lookup_Values used as search criteria. | Excel Worksheet Functions | |||
Match with 2 Lookup_Values used as search criteria. | Excel Worksheet Functions | |||
Deleting rows which match filter | Excel Programming |