Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I am looking for some help to delete the rows in a sheet which have some
Specific words in the cell. For example: i have sub total for every 10 to 15 lines and would like to find out the cell which have "sub total" word int it and delete the whole row. Thanks in advance |
#2
![]() |
|||
|
|||
![]()
One way:
Sub DeleteRow() 'Adapted from Microsoft code found at 'msdn.microsoft.com Dim sFind As String Dim Rng As Range Dim sFindRow As Long sFind = "*sub*total*" Set Rng = Range("A:A").Find(What:=sFind, lookat:=xlWhole) While Not Rng Is Nothing sFindRow = Rng.Row Rng.EntireRow.Delete Set Rng = Range("A" & sFindRow - 1 & ":A" & _ Rows.Count) _ .Find(What:=sFind, lookat:=xlWhole) Wend End Sub To run, press ALT+F11, go to Insert Module, and paste in the code above. Press ALT+Q. And go to Tools Macro Macros to run. This assumes you have data in col. A. HTH Jason Atlanta, GA, USA -----Original Message----- I am looking for some help to delete the rows in a sheet which have some Specific words in the cell. For example: i have sub total for every 10 to 15 lines and would like to find out the cell which have "sub total" word int it and delete the whole row. Thanks in advance . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert rows based on specific value | Excel Worksheet Functions | |||
flexible paste rows function that inserts the right number of rows | Excel Discussion (Misc queries) | |||
Row selections by row # OR by even/odd rows in another spreadsheet | Excel Discussion (Misc queries) | |||
Adding Rows to Master Sheet | New Users to Excel | |||
Copying Rows when hiding other rows | Excel Worksheet Functions |