+ Reply to Thread
Results 1 to 3 of 3

Auto delete row in this specific pattern

  1. #1
    Registered User
    Join Date
    05-25-2007
    Posts
    8

    Auto delete row in this specific pattern

    Hi,

    Can someone help me make a macro that would go through and delete rows in this pattern below:

    1. Keep
    2. Delete
    3. Delete
    4. Delete
    5. Delete

    6. Keep
    7. Delete
    8. Delete
    9. Delete
    10. Delete

    Also, how would I trigger the macro?

    Thanks,
    truongn2

  2. #2
    Forum Contributor boylejob's Avatar
    Join Date
    02-22-2007
    Location
    Forest City, NC
    MS-Off Ver
    2003
    Posts
    562
    truongn2,

    How about something like this. Of course you will need to make a few modifications so it will fit your workwook.

    This codes starts at the bottom and works it way to the top. It deletes 4 rows and then skips one.

    Please Login or Register  to view this content.
    Sincerely,
    Jeff

  3. #3
    Forum Contributor
    Join Date
    07-05-2007
    Location
    Lexington, MA
    Posts
    302

    Find and elimnate rows without VBA

    You might find a non-macro approach useful for similar problems.

    Add new columns say A and B for data rows 1 to 100 (or whatever rows)
    Put 1 in A1 and use Menu Edit: Fill: Series to place numbers 1 to 100 in A1 to A100.
    Use a formula in B to calculate 0 for Delete or 1 for Keep, for each row. Fill Down to generate values in all rows of your data, or just paste the pattern of 0's and 1's that you need.
    Sort the data rows into order on B. All the rows for deletion are now next to each other. Select them and Delete Rows.
    Sort the remaining data on A to get back your original order. You can delete A and B.

    I know this is the Programming Forum, but it can be tiring to write macros all of the time for unusual situations.

+ Reply to Thread

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