Results 1 to 4 of 4

Macro for deleting autofiltered rows

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,077

    Macro for deleting autofiltered rows

    Having decided that I can't ignore macros and VBA any longer if I want to progress my Excel skills, I have recorded a macro today for the following scenario.

    I receive a raw data file from the mainframe which I open in Excel and save and a worksheet. Here's a sample:
    PREFIX CUST.CODE BRANCH CAT DATE OPENED LAST INV.DATE
    A1 A1ENTE 12 8 24/04/06 14/12/06 10,095
    A1 A1TAS 85 8 12/05/05 13/12/06 4,890
    A8 A80132 74 8 11/09/02 0
    AA AAA24 29 8 1/01/86 13/12/06 5,812
    AA AAAANO 58 8 27/07/95 22/09/06 1,239
    My macro first inserts column A and adds a formula to enable me to easily identify cash customers. Next, it creates an autofilter on row 3, which contains the column headings, then filters by column A to delete all rows where column A = "A9"; then filters by column D and deletes a variety of category codes.

    All of this is works fine on the current data file, but when I look at the macro code it refers to specific row numbers in the delete portions. I want to use this macro every month, but the row numbers in each category can change because the number of customers will (hopefully!) increase. Is there any way to make the macro delete everything selected by the autofilter without specifically referring to row numbers?
    Last edited by tuph; 12-17-2006 at 07:35 PM.
    Trish in Oz
    -------------
    A problem well defined is a puzzle half solved


    If you attach a sample of your workbook it will be easier to find a solution. Remember to remove/replace sensitive data before uploading the file. Look here if you need help with attachments:
    http://www.excelforum.com/faq.php?fa...b3_attachments

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1