Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pablo
 
Posts: n/a
Default deleting multiple rows

Hello:

I need to be able to delete multiple rows out of a worksheet. What I need to
be able to do is have a function/macro that can identify a string of
characters and then delete all the rows that have those characters.

For example, if row 4, 18, and 45 all had "blue" in them (assume column is
A), then I need something to go delete row, 4, 18, and 45.

At the top of my worksheet I will have several, probably about 3, criteria,
such as, "blue", "red", and "green" that will all need to be deleted.

Now here's where I really need help. A row may have "blue-orange" and if
"blue" is the key identifier, the row with "blue-orange" will need to be
deleted also.

Thanks!


  #2   Report Post  
Gary Rowe
 
Posts: n/a
Default

perhaps autofilter might do this for you. You can select a custom filter
selection using a starts with or contains "blue" and delete the rows that
meet the criteria.

"Pablo" wrote:

Hello:

I need to be able to delete multiple rows out of a worksheet. What I need to
be able to do is have a function/macro that can identify a string of
characters and then delete all the rows that have those characters.

For example, if row 4, 18, and 45 all had "blue" in them (assume column is
A), then I need something to go delete row, 4, 18, and 45.

At the top of my worksheet I will have several, probably about 3, criteria,
such as, "blue", "red", and "green" that will all need to be deleted.

Now here's where I really need help. A row may have "blue-orange" and if
"blue" is the key identifier, the row with "blue-orange" will need to be
deleted also.

Thanks!



  #3   Report Post  
R.VENKATARAMAN
 
Posts: n/a
Default

try this url in vbeditor and run

Public Sub test()
line2:
Range("a1").Activate
On Error GoTo line1

Cells.Find(what:="blue").Activate
ActiveCell.EntireRow.Delete
GoTo line2
line1:
End Sub

it will remove all rows containing blue as string or sustring
==================================

Gary Rowe wrote in message
...
perhaps autofilter might do this for you. You can select a custom filter
selection using a starts with or contains "blue" and delete the rows that
meet the criteria.

"Pablo" wrote:

Hello:

I need to be able to delete multiple rows out of a worksheet. What I

need to
be able to do is have a function/macro that can identify a string of
characters and then delete all the rows that have those characters.

For example, if row 4, 18, and 45 all had "blue" in them (assume column

is
A), then I need something to go delete row, 4, 18, and 45.

At the top of my worksheet I will have several, probably about 3,

criteria,
such as, "blue", "red", and "green" that will all need to be deleted.

Now here's where I really need help. A row may have "blue-orange" and if
"blue" is the key identifier, the row with "blue-orange" will need to be
deleted also.

Thanks!





  #4   Report Post  
Native
 
Posts: n/a
Default

this is great! two more questions:

a) how can this be modified to delete not only the row with "blue", but
the next 5 rows as well?
b) can the search for "blue" begin only after say row 10?

  #5   Report Post  
Pablo
 
Posts: n/a
Default

What I mean by this is, when a "blue" is detected and the macro goes to
delete that row, I'd like it to also delete the next 5 rows as well.

Part B, can the first 10 rows be excluded from this search? (ie-start the
search at A11)



Public Sub test()
line2:
Range("a1").Activate
On Error GoTo line1

Cells.Find(what:="blue").Activate
ActiveCell.EntireRow.Delete
GoTo line2
line1:
End Sub




"Native" wrote in message
oups.com...
this is great! two more questions:

a) how can this be modified to delete not only the row with "blue", but
the next 5 rows as well?
b) can the search for "blue" begin only after say row 10?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find duplicate rows then deleting them SSHO_99 Excel Worksheet Functions 4 May 4th 07 11:17 AM
Convert multiple columns to rows Lois Lane Excel Worksheet Functions 8 January 10th 05 12:47 AM
Multiple rows of data on a single axis (charting) ramseysgirl Charts and Charting in Excel 8 December 29th 04 06:00 PM
Inserting Multiple Rows with Formulas ShineboxNJ Excel Worksheet Functions 2 November 18th 04 02:30 AM
Count rows based on multiple criteria Murph Excel Worksheet Functions 1 October 28th 04 07:13 AM


All times are GMT +1. The time now is 01:55 PM.

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

About Us

"It's about Microsoft Excel"