Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Raza
 
Posts: n/a
Default Delete rows by content

I am trying to automate many of the task that I do with excel. One of those
tasks it to sort a database. I've made a macro to do most of the work for me
but one aspect has stumped me.

I want to delete rows in the spreadsheet by what their memeber number is.
Example:
Column A contains the members numbers.
members from gym X are as follows: X0001, X0002, X0003, etc.
members from gym Y are as follows: Y0001, Y0002, Y0003, etc.
members from gym Z are as follows: Z0001, Z0002, Z0003, etc. (you get the
idea)

I want to delete any members from gym X and Z (or any other crazy number in
the database) but keep my members for gym Y.
The amount of members is always changing. Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RB-MC
 
Posts: n/a
Default Delete rows by content

Why not simply filter the database for the gym members you want to
delete, delete the filtered rows and undo the filter?

HTH


On Sat, 19 Nov 2005 11:18:03 -0800, "Raza"
wrote:

I am trying to automate many of the task that I do with excel. One of those
tasks it to sort a database. I've made a macro to do most of the work for me
but one aspect has stumped me.

I want to delete rows in the spreadsheet by what their memeber number is.
Example:
Column A contains the members numbers.
members from gym X are as follows: X0001, X0002, X0003, etc.
members from gym Y are as follows: Y0001, Y0002, Y0003, etc.
members from gym Z are as follows: Z0001, Z0002, Z0003, etc. (you get the
idea)

I want to delete any members from gym X and Z (or any other crazy number in
the database) but keep my members for gym Y.
The amount of members is always changing. Any suggestions?


RB
__
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
bpeltzer
 
Posts: n/a
Default Delete rows by content

Dim sourcerow
sourcerow = 1
While Cells(sourcerow, 1) < ""
if left(cells(sourcerow,1))<"Y" then
rows(sourcerow & ":" & sourcerow).delete
else
sourcerow = sourcerow + 1
end if
Wend
This just continues until it finds column A blank in the next sourcerow.
While not blank, it checks for members not like Y* and deletes such rows. If
this is a long list, you may want to turn screenupdating off before the loop
and back on after (application.screenupdating = false,
application.screenupdating = true).
--Bruce


"Raza" wrote:

I am trying to automate many of the task that I do with excel. One of those
tasks it to sort a database. I've made a macro to do most of the work for me
but one aspect has stumped me.

I want to delete rows in the spreadsheet by what their memeber number is.
Example:
Column A contains the members numbers.
members from gym X are as follows: X0001, X0002, X0003, etc.
members from gym Y are as follows: Y0001, Y0002, Y0003, etc.
members from gym Z are as follows: Z0001, Z0002, Z0003, etc. (you get the
idea)

I want to delete any members from gym X and Z (or any other crazy number in
the database) but keep my members for gym Y.
The amount of members is always changing. Any suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Delete rows by content

And just to add to RB-MC's reply:

You can choose a custom filter of "begins with" to show the X##### cells.

Then you can delete the visible rows and do it again.

RB-MC wrote:

Why not simply filter the database for the gym members you want to
delete, delete the filtered rows and undo the filter?

HTH

On Sat, 19 Nov 2005 11:18:03 -0800, "Raza"
wrote:

I am trying to automate many of the task that I do with excel. One of those
tasks it to sort a database. I've made a macro to do most of the work for me
but one aspect has stumped me.

I want to delete rows in the spreadsheet by what their memeber number is.
Example:
Column A contains the members numbers.
members from gym X are as follows: X0001, X0002, X0003, etc.
members from gym Y are as follows: Y0001, Y0002, Y0003, etc.
members from gym Z are as follows: Z0001, Z0002, Z0003, etc. (you get the
idea)

I want to delete any members from gym X and Z (or any other crazy number in
the database) but keep my members for gym Y.
The amount of members is always changing. Any suggestions?


RB
__


--

Dave Peterson
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
How to delete rows Khers Excel Discussion (Misc queries) 1 August 17th 05 01:09 PM
how do i prevent a #REF! error when i delete non adjacent rows? ChuckSF Excel Worksheet Functions 1 August 5th 05 05:08 AM
How do I find duplicate rows in a list in Excel, and not delete it Matthew in FL Excel Discussion (Misc queries) 2 June 15th 05 09:11 PM
can't delete a cell content in excel Mark B New Users to Excel 3 May 6th 05 06:42 PM
delete empty rows between rows with text Paulo Baptista Excel Discussion (Misc queries) 2 February 28th 05 03:41 PM


All times are GMT +1. The time now is 09:34 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"