A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Deleteing some Rows



 
 
Thread Tools Display Modes
  #1  
Old April 1st, 2005, 05:53 PM
Deepwater
external usenet poster
 
Posts: n/a
Default 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  
Old April 1st, 2005, 06:23 PM
Jason Morin
external usenet poster
 
Posts: n/a
Default

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT +1. The time now is 04:46 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.