if/then macro

  • I am trying to create a macro to do the following steps on a report, but I am having trouble with the if/then statements. Can anyone help me create a macro that would do all of these steps? Is it even possible to do this?


    Select All

    Sort by Column A

    If Column A is not equal to "1", then delete entire row

    Format Column J to $

    Select All

    Sort by Column L

    If Column L is equal to "VOID", then delete entire row

    If Column L is equal to "CREDIT", then change column J to a negative number

    Select all

    Sort by Column K

    Insert 5 rows under all rows that Column K is equal to A (to create a grouping of everything that equals A)

    Insert 5 rows under all rows that Column K is equal to D (to create a grouping of everything that equals D)

    Sort by Column J of all rows that Column K is equal to A

    Sort by Column J of all rows that Column K is equal to D

    Sort by Column J of all rows that Column K is equal to M or D

    Autosum Column J of all rows that Column K is equal to A

    Autosum Column J of all rows that Column K is equal to D

    Autosum Column J of all rows that Column K is equal to M or D

    Insert new column after Column J

    Copy Column J

    Paste into new Column K


    Thank you!!

  • Hello and Welcome to the Forum :)


    Would recommend to attach a sample file ...


    It will make everything much easier ... for everybody ;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Like" icon ...just below...in the bottom right corner...:)

  • Hello Laura,


    Thanks for your test file.


    Regarding the 15 actions to be executed, have you turned on your macro recorder and did you go through your process once to get the initial macro backbone ...?

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Like" icon ...just below...in the bottom right corner...:)

  • Hello again,


    Attached is the Version 1 file which deals with the 4 requested steps ...


    When it comes to inserting rows... sorry but cannot understand the objective ...

    Files

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Like" icon ...just below...in the bottom right corner...:)