Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Macro help

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have various data in a column, and I want to include deleting them in a formula macro.

    For example, I want the macro to run so that whenever it sees ANY ROW which contains the Text XX, YY, or ZZ etc it erases it.


    So the macro would basically look for any of those three values and delete the entire row they are in. It seems tough--any suggestions?


  2. #2
    Board Regular
    Join Date
    Mar 2002
    Posts
    363
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try this:

    Sub Delete_XX_YY_ZZ()
    Cells.Find(What:="XX").EntireRow.Delete
    Cells.Find(What:="YY").EntireRow.Delete
    Cells.Find(What:="ZZ").EntireRow.Delete
    End Sub

    It's never too late to learn something new.

    Ricky

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Awesome!

    But, where do I type that in? Is there a drop down menu command, do I highlight it? Ideas?

    I'm a novice

    Thanks.

    [ This Message was edited by: XLerator on 2002-04-11 18:53 ]

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    London, UK
    Posts
    167
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    1. go into TOOLS > MACRO > VISUAL BASIC EDITOR

    2. right click on the workbook or any of its objects, and choose ADD > MODULE

    3. in the new module, paste this code.

    4. with the cursor in the block of code, press F5 to run it. Otherwise, close down the visual basic editor window, and you can activate the macro by going into TOOLS > MACRO > MACROS and running it from there.


    <table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;"> DALEY :P </td></table>

  5. #5
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-11 18:39, XLerator wrote:
    Awesome!

    But, where do I type that in? Is there a drop down menu command, do I highlight it? Ideas?

    I'm a novice

    Thanks.

    [ This Message was edited by: XLerator on 2002-04-11 18:53 ]
    The code will only delete the 1st occurance
    of each search string.
    If you want to get rid of ALL occurances then
    repost...
    Kind Regards,
    Ivan F Moala From the City of Sails

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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