11

Click here to load reader

Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

Embed Size (px)

Citation preview

Page 1: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

Macros in ExcelMacros in Excel

Intro to lab 1

Page 2: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsMacro is recorded in VBA module sequence of

Excel operationsMacros can automate tasks in ExcelMacro could be

– a part of current Excel worksheet (available in this worksheet only) or

– recorded in special worksheet called personal (available in all user worksheets)

Page 3: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsTo enable creation and use of macros:

– In Excel Options: Turn on the Developer ribbon – Customize Ribbon Change options in The Trust Center:

– Trust center settings/Macro Settings

• Disable all macros with notification

• Check: Trust access to the VBA project object model

– To save worksheet including macro: Use Save as: Excel Macro-Enabled Workbook

– To open workbook with macro: When open Security Warning will appear, press: Enable

Content button

Page 4: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsTo record a new macro

– Bring Developer ribbon to front– Press: Record Macro button

Fill popup window (name, where to store macro, description)

– Start sequences to be recorded– Press: Stop Recording button.

Page 5: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsTo use recorded macro, method 1, from

developer ribbon– Bring Developer ribbon to front

Press: Macros button Choos macro from the list Press Run button

– Start sequences to be recorded– Press: Stop Recording button.

Page 6: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsTo use recorded macro, method 2, add new

button on the custom ribbon– Customize Ribbon (menu-options, right click on

ribbon)– Add a New Tab– Find macro in right-hand window from commands

group Macros– Add to the New Group in New Tab

Page 7: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsTo use recorded macro, method 3, add a button

to the Sheet– In Developer ribbon, group Controls, press Insert

button– In the Form Controls part press button– Draw a button in the sheet– In the popup window choose a macro from the list– Press OK.

Page 8: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsTo use recorded macro, method 4,

– Use shortcut keys combination defined while macro was created

Page 9: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsMacros types

– Macros with non relative references– Macros with relative references

Page 10: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsMacros with non relative references

– They are default type– Macro works always on the same cells in worksheet– First step is the selection of the cell (cells)

Page 11: Macros in Excel Intro to lab 1. Macroinstructions Macro is recorded in VBA module sequence of Excel operations Macros can automate tasks in Excel Macro

MacroinstructionsMacroinstructionsMacros with non relative references

– Macro works always on the cells relative to active cell on macro start in worksheet. This cell is the Basic Cell

– If the macro have to be used on another part of the Sheet last operation recorded in the Sheet have to be the activation of the new Basic Cell