create a macro

Upload: cherikok

Post on 28-Feb-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/25/2019 Create a Macro

    1/18

    Create A Macro

  • 7/25/2019 Create a Macro

    2/18

    Macro

    an action or a set of actions that you can run as times as you want.

    you are recording your mouse clicks and keystro

    After you create a macro, you can edit it to makechanges to the way it works.

  • 7/25/2019 Create a Macro

    3/18

    Activation For Macro

    Before you record a macro

    Make sure the Developertab is visible on the ribbondefault, the Developertab is not visible, so do the fo

    Click the Filetab, click Optionsand then click theCustomize Ribboncategory.

    nder Customize the Ribbon, in the Main TabslistDeveloper, and then click OK.

  • 7/25/2019 Create a Macro

    4/18

    Create !hortcut key

    "o assign a C"#$ combination shortcut key to rumacro, in the Shortcut eybo%, ty&e any lowerletter or u&&ercase letter that you want to use.

    !ote "he shortcut key will override any e'uivalent (%cel shortcut key while the workbook that contains tis o&en.

  • 7/25/2019 Create a Macro

    5/18

    !tore Macro )n $ist

    select the workbook where you want to store the Tip )f you want a macro to be available whene

    use (%cel, select "ersonal Macro #orboo. *you select "ersonal Macro #orboo, (%cel chidden &ersonal macro workbook +ersonal.%lsb-

    does not already e%ist, and saves the macro in tworkbook.

  • 7/25/2019 Create a Macro

    6/18

    Create ame For Macro

    )n the Macro namebo%, enter a name for the m !ote "he /rst character of the macro name must b

    !ubse'uent characters can be letters, numbers, or uncharacters. !&aces cannot be used in a macro name0underscore character works well as a word se&aratoruse a macro name that is also a cell reference, you m

    an error message that the macro name is not valid.

    )n the Descriptionbo%, ty&e a descri&tion of thmacro.

    Click OKto start recording.

  • 7/25/2019 Create a Macro

    7/18

    #ecord A Macro

  • 7/25/2019 Create a Macro

    8/18

    #ed !ha&e Button

    )n (%cel, Macro recording can be started by clickthe #ed !ha&e button marked in the bottom bar(%cel in left hand side.

  • 7/25/2019 Create a Macro

    9/18

    #ecord Macro Button

    (nter the suitable name for this Macro.

    1ou can also s&ecify the shortcut key for ru&articular recorded macro.

    )t means on &ressi

    &articular shortcutmacro will automarun.

  • 7/25/2019 Create a Macro

    10/18

    !toring Macro

    Macros can be stored in either of two locat

    "he workbook youusing, +will be embeven if you e2mail another user- or

    1our ersonal Mac*orkbook +it will aavailable in all of yworkbooks

  • 7/25/2019 Create a Macro

    11/18

    Create ew Macro *ith art 3f(%isting Macro 3&en the workbook that contains the macro that you want to co&y.

    3n the Developertab, in the Codegrou&, click Macros.

    )n the Macro namebo%, click the name of the macro that you want to co&y.

    Click $dit.

    )n the code window of the 4isual Basic (ditor, select the lines of the macro that yco&y.

    3n the $ditmenu, click Copy.

    Tip 1ou can also right2click and then click Copy, or you can &ress C"#$5C.

    )n the "rocedurebo% of the code window, click the module where you want to &code.

    3n the $ditmenu, click "aste.

    Tip 1ou can also right2click and then click "aste, or you can &ress C"#$54.

    Tip 1ou cannot edit your ersonal Macro *orkbook /le +ersonal.%lsb- becauseworkbook that is always o&en. 1ou must /rst unhide it by using the %nhidecommcan also o&en it in the 4isual Basic (ditor by &ressing A$"5F66.

  • 7/25/2019 Create a Macro

    12/18

    Assign A Macro "o An 3b7ect,8ra&hic, 3r Control

    3n a worksheet, right2click the ob7ect, gra&hic, ocontrol to which you want to assign an e%isting mand then click Assign Macro.

    )n the Macro name bo%, click the macro that youassign.

  • 7/25/2019 Create a Macro

    13/18

    9elete A Macro 9o one of the following:

    3&en the workbook that contains the macro that you want to delete.

    )f the macro that you want to delete is stored in the &ersonal macro wor+ersonal.%lsb-, and this workbook is hidden, do the following to unhide workbook:

    3n the &ie'tab, in the #indo'grou&, click %nhide.

    nder %nhide 'orboos, click (#!3A$, and then click OK.

    3n the 9evelo&er tab, in the Code grou&, click Macros.

    )n the Macros in list, select the workbook that contains the macrwant to delete. For e%am&le, click "his *orkbook.

    )n the Macro name bo%, click the name of the macro that you wadelete.

    Click 9elete.

  • 7/25/2019 Create a Macro

    14/18

    #un "he Macro

  • 7/25/2019 Create a Macro

    15/18

    #un A Macro By Clicking A Butto3n "he uick Access "oolbar6.Click the Filetab, Options, and then click (uic )ccess Too

    ;.)n the Choose commands fromlist, select Macros.

  • 7/25/2019 Create a Macro

    16/18

    #un A Macro By Clicking An AreA 8ra&hic 3b7ect

    )n the worksheet, insert a gra&hic ob7ect, such as a &ictuart, sha&e, or !martArt.

    3n the e%isting ob7ect, on the )nsert tab, in the )llustratiogrou&, click !ha&es, select the sha&e that you want to uthen draw that sha&e on the e%isting ob7ect.

    #ight2click the hot s&ot that you created, and then click Macro.

    "o assign an e%isting macro to the gra&hic ob7ect, double

    the macro or enter its name in the Macro namebo%.

  • 7/25/2019 Create a Macro

    17/18

    "o record a new macro to assign to the selected gra&hic ob7ect, click #a name for the macro in the #ecord Macro dialog bo%, and then click 3recording your macro. *hen you /nish recording the macro, click !to&Button image on the 9evelo&er tab in the Code grou&.

    "i& 1ou can also click !to& #ecording Button image on the left side of the sta

    "o edit an e%isting macro, click the name of the macro in the Macro naand then click (dit.

    Click 3.

    )n the worksheet, select the hot s&ot. "his dis&lays the 9rawing "ools, Format tab.

    3n the Format tab, in the !ha&e !tyles grou&, click the arrow ne%t to !and then click o Fill.

    Click the arrow ne%t to Shape Outline, and then click !o Outline.

  • 7/25/2019 Create a Macro

    18/18

    Create An Auto2o&en Macro

    )f you want to save the macro with a &articular workb

    o&en that workbook /rst. 3n the 9evelo&er tab, in the Code grou&, click #ecor

    )n the Macro name bo%, ty&e Auto3&en.

    )n the !tore macro in list, select the workbook wherewant to store the macro.

    Click 3, and then &erform the actions that you wantrecord.

    3n the 9evelo&er tab, in the Code grou&, click !toecording Button image.