Presentation is loading. Please wait.

Presentation is loading. Please wait.

With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010.

Similar presentations


Presentation on theme: "With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010."— Presentation transcript:

1 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010 Chapter 9 Using Macros and Visual Basic for Applications

2 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall2 Objectives Record a Macro Assign a Macro to a Button on the Quick Access Toolbar Modify a Macro Write a VBA Procedure to Use an ActiveX Control Restore Initial Settings

3 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall3 Record a Macro Macro –An action or a set of actions that automate tasks by grouping a series of commands into a single command –Recorded in Visual Basic for Applications (VBA) programming language VBA is the language used to write computer programs within the Microsoft Windows environment

4 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall4 Record a Macro To work with macros: –Add the Developer tab to the Ribbon, which displays the commands –Select a macro security setting to enable macros when using Excel –Save the workbook that includes macros as an Excel Macro-Enabled Workbook file type

5 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall5 Record a Macro Adding the Developer Tab to the Ribbon

6 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall6 Record a Macro Developer tab displays on the ribbon Code group contains commands to work macros

7 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall7 Record a Macro To enable macros in the workbook: set the security level on the computer to allow the option of enabling the macros

8 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall8 Record a Macro Macro Settings and Their Effects

9 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall9 Record a Macro Excel provides safeguards against viruses transmitted by macros. Digital signature –Certifies macros shared with others –Secure stamp of authentication

10 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall10 Record a Macro Macro recorder –Records all steps required by the macro –Will not record navigation on the Ribbon, –Records in VBA programming language

11 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall11 Record a Macro

12 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall12 Record a Macro Event − The action that causes the macro to run − Might be a combination of keystrokes or the click of a button

13 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall13 Modify a Macro Module –Programming code written in VBA that records a new macro –The place where the VBA code is stored –Consists of procedures A unit of computer code that performs some type action

14 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall14 Modify a Macro Visual Basic Editor window—where the module containing the Visual Basic code can be viewed

15 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall15 Modify a Macro

16 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall16 Modify a Macro Sub procedure—abbreviated sub –A set of instructions that accomplishes a specific task –Sub indicates the beginning of the Sub procedure. –End Sub indicates the end of the sub procedure.

17 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall17 Modify a Macro The word With notes the beginning of a VBA construct—an instruction that enables the macro to perform multiple operations on a single object.

18 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall18 Write a VBA Procedure to Use an ActiveX Control Write a procedure that will insert an ActiveX control into a form A procedure is a named sequence of statements in a computer program that performs a task.

19 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall19 Write a VBA Procedure to Use an ActiveX Control An ActiveX control is a graphic object –Such as a check box or a button that you place on a form –Can be used to Display or enter data To perform an action To make the form easier to read

20 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall20 Write a VBA Procedure to Use an ActiveX Control ActiveX controls –Especially useful for forms that individuals complete online –Can control different events that occur when a control is used A check box is a type of ActiveX control that is used when filling in a form

21 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall21 Write a VBA Procedure to Use an ActiveX Control Embed—insert something from one program to another program –ActiveX controls not part of Excel –May be added Design Mode—enables working with ActiveX controls

22 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall22 Write a VBA Procedure to Use an ActiveX Control Each ActiveX control has a set of properties—characteristics—that can be changed.

23 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall23 Write a VBA Procedure to Use an ActiveX Control

24 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall24 Write a VBA Procedure to Use an ActiveX Control Comments –Display in green –Preceded by an apostrophe (‘) –Document the procedure with comments –Does not affect the procedure

25 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall25 Write a VBA Procedure to Use an ActiveX Control

26 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall26 Write a VBA Procedure to Use an ActiveX Control

27 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall27 Write a VBA Procedure to Use an ActiveX Control A VBA procedure can be modified in the same manner as a VBA code. To add a second message box to the existing code use an If, Then Else statement.

28 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall28 Write a VBA Procedure to Use an ActiveX Control

29 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall29 Write a VBA Procedure to Use an ActiveX Control If an error message displays in the message box, click Debug to return to the Visual Basic Editor window. Correct the error highlighted in yellow. On the file menu, click Close and Return to Microsoft Excel, try the procedure again.

30 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall30 Objectives Covered Record a Macro Assign a Macro to a Button on the Quick Access Toolbar Modify a Macro Write a VBA Procedure to Use an ActiveX Control Restore Initial Settings

31 with Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall31 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. Copyright © 2011 Pearson Education, Inc. Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall


Download ppt "With Microsoft Excel 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Excel 2010."

Similar presentations


Ads by Google