Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Macros and VBA A macro is a set of instructions that tells Excel which commands to execute.

Similar presentations


Presentation on theme: "Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Macros and VBA A macro is a set of instructions that tells Excel which commands to execute."— Presentation transcript:

1 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Macros and VBA A macro is a set of instructions that tells Excel which commands to execute Visual Basic a programming language used to create macros You do not have to be a programmer to write macros

2 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 2 Create a Macro with the Macro Recorder Comments provide information about the macro, but do not affect its execution and are considered documentation To use the recorder, click the Macros down arrow in the Macros group and select Record Macros From that point until you stop recording, every command you execute will be stored by the recorder

3 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 3 Create a Macro with the Macro Recorder Excel has two other file formats that store macros:  XLSM files, which are macro enabled workbooks, are stored using XML  XLSB files, which are workbooks stored in binary format, are often used for very large spreadsheets

4 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 4 Create a Macro with the Macro Recorder The Macro Recorder has some issues:  Everything you do once you begin recording a macro becomes part of the macro  Take your time and be sure the action is correct  Try to ensure your macros are broad enough to apply to a variety of situations The Visual Basic Editor (VBE) is used to create, edit, execute, and debug Excel macros

5 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 5 Create a Macro with the Macro Recorder

6 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 6 Create a Macro with the Macro Recorder To create a macro: 1. Click Record Macro in the Macros down arrow in the Macros group of the View tab to open the Record Macro dialog box 2. Type a name for the macro in the Macro name text box 3. Create a keyboard shortcut, if desired, for your macro in the Shortcut key box 4. Select a location to store the macro from the Store macro in drop-down arrow 5. Click OK to start recording the Macro

7 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 7 Create a Macro with the Macro Recorder

8 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 8 Create Macro Buttons May prefer to have a button on the Quick Access Toolbar Requires that the Developer tab is added to the Ribbon first  To place the Developer tab on the ribbon, click the Microsoft Office button and click Excel Options  Choose the Popular section and check Show Developer tab on the Ribbon

9 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 9 Work with Macro Security The proliferation of Excel macro viruses has made it a dangerous operation to open spreadsheets that contain viruses To counter this threat, when you open an Excel workbook that contains macros, Excel automatically disables the macros and displays the Security Warning Macros have been disabled message Click Options to open the Microsoft Office Security Options dialog box

10 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 10 Work with Macro Security

11 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 11 Understand the basics of VBA Starting with Office 95, the recorded keystrokes of a macro were translated into Visual Basic commands Can execute Visual Basic programs from within Excel Microsoft Office uses a subset of Visual Basic known as Visual Basic for Applications (VBA) You are not expected to be a programmer, but you do need to know the capabilities of VBA and its relationship with Excel


Download ppt "Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Macros and VBA A macro is a set of instructions that tells Excel which commands to execute."

Similar presentations


Ads by Google