If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Deleteing some Rows
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 . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Insert rows | Mr. G. | Worksheet Functions | 3 | March 31st, 2005 03:49 AM |
flexible paste rows function that inserts the right number of rows | marika1981 | General Discussion | 1 | February 18th, 2005 02:40 AM |
Row selections by row # OR by even/odd rows in another spreadsheet | Tom | General Discussion | 0 | February 9th, 2005 04:03 PM |
Freezing top and bottom rows | sglanton | Worksheet Functions | 5 | August 20th, 2004 11:36 PM |
Pivot Table Too Many Rows Or Colums | Joe | Worksheet Functions | 0 | October 9th, 2003 05:17 PM |