Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Macro to keep pair of number (Excel 2003)

    I have 2 columns of numbers, i want to keep all the numbers that have a 1 in COL A and a 3 in COL B and delete all the rest of the rows.

    What is the most efficient/fastest way to code this? thank you.

  2. #2
    Bronze Lounger
    Join Date
    Jun 2001
    Location
    New York, New York, Lebanon
    Posts
    1,449
    Thanks
    1
    Thanked 1 Time in 1 Post

    Re: Macro to keep pair of number (Excel 2003)

    <img src=/S/hello.gif border=0 alt=hello width=25 height=29> jha900

    Ok couple of questions:

    1) Can the worksheet be sorted so that all the 1s and 3s will be together, in a contiguous range? If not, can we sort it temporary using a new column of sort order, and then return the worksheet after the deletion is done?

    What I am envisioning is:

    1) Write an If Formula, in a new column. if the Column A has a 1, and Column B has a 3 give 1, else give 0
    2) Sort and delete the block with 0s

    I think this is the fastest way.

    Maybe someone will tell us both that it is not, <img src=/S/duck.gif border=0 alt=duck width=23 height=23>

    Cheers

    Wassim
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20> in the <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro to keep pair of number (Excel 2003)

    You could use Advanced Filter with criteria looking like this:

    <table border=1><td>Field1</td><td>Field2</td><tr><td><>1</td><td align=right>

Posting Permissions

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