VBA and Macros for Microsoft Excel (Business Solutions)De (autor) Bill Jelen, Tracy Syrstad
en Limba Engleză Carte Paperback – May 2004
A thorough introduction to programming macros with Microsoft Excel and VBA.
- Developers can take advantage of VBA's capabilities with instruction for customizing Excel database applications to meet business needs.
- Developers can save money by using this book instead of building custom applications from the ground up.
- Written by an Excel VBA expert with over 18 years experience.
Microsoft Visual Basic for Applications (VBA) is a powerful development technology for customizing desktop applications and integrating them with existing data and systems, enabling customers to buy off-the-shelf software and customize it to meet their specific needs. This is a big cost-saving solution for most business who cannot afford to build programs from scratch. There are an estimated 65 million Excel users. Many are Excel power users, but few have figured out how to effectively use Excel VBA. This book teaches the skills necessary to use Microsoft VBA to customize the Excel spreadsheet. No prior programming knowledge is assumed. It takes a reader who has, perhaps, built a couple of macros from a standing start to a complete knowledge of the VBA language. Topics covered include: event programming, user forms, charts, pivot tables, Web queries, multi-dimensional arrays, classes, records, and collections, and more! Bill Jelen is an accomplished Excel author and the principal behind the leading Excel website, MrExcel.com. As an Excel consultant, he has written Excel VBA solutions for over 300 clients around the English-speaking world. His website hosts over 10 million page views annually. Prior to founding MrExcel.com, Jelen spent twelve years in the trenches, - working as a financial analyst for finance, marketing, accounting and operations departments of a $500 million public company.
Getting Results with VBA.
What Is in This Book.
A Brief History of Spreadsheets and Macros.
The Future of VBA and Excel.
Special Elements and Typographical Conventions.
I. FIRST STEPS UP THE VBA LEARNING CURVE.
1. Unleash the Power of Excel with VBA!
The Power of Excel.
Barriers to Entry.
Knowing Your Tools-The Visual Basic Toolbar.
Overview of Recording, Storing, and Running a Macro.
Running a Macro.
Understanding the Visual Basic Editor (VBE).
Examining Code in the Programming Window.
Running the Macro on Another Day Produces Undesired Results.
Next Steps: Learning VBA Is the Solution.
2. This Sounds Like BASIC, So Why Doesn't It Look Familiar?
I Can't Understand This Code. Understanding the Parts of VBA "Speech". Is VBA Really This Hard? No! Examining Recorded Macro Code-Using the VB Editor and Help. Using Debugging Tools to Figure Out Recorded Code. The Ultimate Reference to All Objects, Methods, Properties. Five Easy Tips for Cleaning Up Recorded Code. Putting It All Together-Fixing the Recorded Code. Next Steps.
3. Referring to Ranges.
The Range Object. Using the Top-Left and Bottom-Right Corners of a Selection to Specify a Range. Referencing Ranges in Other Sheets. Referencing a Range Relative to Another Range. Using the Cells Property to Select a Range. Using the Offset Property to Refer to a Range. Using the Resize Property to Change the Size of a Range. Using the Columns and Rows Properties to Specify a Range. Using the Union Method to Join Multiple Ranges. Using the Intersect Method to Create a New Range from Overlapping Ranges. Using the IsEmpty Function to Check Whether a Cell Is Empty. Using the CurrentRegion Property to Quickly Select a Data Range. Using the Areas Collection to Return a Non-contiguous Range. Next Steps.
4. User-Defined Functions.
Creating User-Defined Functions. Useful Custom Excel Functions. Next Steps.
For...Next Loops. Do Loops. The VBA Loop: For Each. Next Steps.
6. R1C1 Style Formulas.
Referring to Cells: A1 Versus R1C1 References.
Switching Excel to Display R1C1 Style References.
The Miracle of Excel Formulas.
Explanation of R1C1 Reference Style.
Conditional Formatting-R1C1 Required.
Array Formulas Require Conditional
Formatting. Next Steps.
Global Versus Local Names.
Types of Names.
Checking for the Existence of a Name.
8. Event Programming.
Levels of Events.
9. UserForms-An Introduction.
User Interaction Methods.
Creating a Userform.
Calling and Hiding a Userform.
Using Basic Form Controls.
Using the Multipage Control to Combine Forms.
II. AUTOMATING EXCEL POWER IN VBA.
Embedded Charts Versus ChartSheets.
Creating a Chart with VBA.
Using Object Variables to Streamline Code.
The Anatomy of a Chart.
Table of Chart Types.
Details of Various Chart Types.
Exporting Charts as Images.
Drawing with X-Y Charts.
Custom Charts with VBA.
11. Data Mining with Advanced Filter.
Advanced Filter Is Easier in VBA Than in Excel.
Using Advanced Filter to Extract a Unique List of Values.
Using Advanced Filter with Criteria Ranges.
Using "Filter in Place" in Advanced Filter.
The Real Workhorse: xlFilterCopy with All Records Instead of Unique Records Only.
12. Pivot Tables.
Creating a Vanilla Pivot Table in Excel Interface.
Building a Pivot Table in Excel VBA.
Revenue by Customer for a Product Line Manager.
Handling Additional Annoyances.
Product Profitability-Issues with Two or More Data Fields.
Summarizing Date Fields with Grouping.
Advanced Pivot Table Techniques.
Sum, Average, Count, Min, Max, and More.
13. Excel Power.
Using VBA to Extend Excel.
Combining and Separating Workbooks.
Working with Cell Comments.
Utilities to Wow Your Clients.
Techniques for VBA Pros.
14. Reading from and Writing to the Web.
Getting Data from the Web.
Using Streaming Data.
Using Application.OnTime to Periodically Analyze Data.
Publishing Data to a Web Page.
15. XML in Excel 2003 Professional.
What Is XML?
Simple XML Rules.
Universal File Format.
XML as the New Universal File Format.
The Alphabet Soup of XML.
Using XML to Round-Trip a Workbook from Excel to HTML and Back.
16. Automating Word.
Creating and Referencing Objects.
III. TECHIE STUFF YOU WILL NEED TO PRODUCE APPLICATIONS FOR THE ADMINISTRATOR TO RUN.
Declare an Array.
Fill an Array.
Empty an Array.
Arrays Can Make It Easier to Manipulate Data, But Is That All?
Passing an Array.
18. Text File Processing.
Importing from Text Files.
Writing Text Files.
19. Using Access as a Back End to Enhance Multi-User Access to Data.
ADO Versus DAO.
The Tools of ADO.
Adding a Record to the Database.
Retrieving Records from the Database.
Updating an Existing Record.
Deleting Records via ADO.
Summarizing Records via ADO.
Other Utilities via ADO.
20. Creating Classes, Records, and Collections.
Inserting a Class Module.
Trapping Application and Embedded Chart Events.
Creating a Custom Object.
Using a Custom Object.
Using Property Let and Property Get to Control How Users Utilize Custom Objects.
User-Defined Types (UDTs).
21. Advanced UserForm Techniques.
Using the UserForm Toolbar in the Design of Controls on UserForms.
Controls and Collections.
More UserForm Controls.
Hyperlinks in Userforms.
Adding Controls at Runtime.
Using a Scrollbar as a Slider to Select Values.
Adding Help Tips to Controls.
Coloring the Active Control.
22. Windows Application Programming Interface (API).
What Is the Windows API?
Understanding an API Declaration.
Using an API Declaration.
Finding More API Declarations.
23. Handling Errors.
What Happens When an Error Occurs.
Basic Error Handling with the On Error GoTo Syntax.
Generic Error Handlers.
Train Your Clients.
Errors While Developing Versus Errors Months Later.
The Ills of Protecting Code.
More Problems with Passwords.
Errors Caused by Different Versions.
24. Using Custom Menus to Run Macros.
Creating a Custom Menu.
Creating a Custom Toolbar.
Other Ways to Run a Macro.
Characteristics of Standard Add-Ins.
Converting an Excel Workbook to an Add-In.
Having Your Client Install the Add-In.
Using a Hidden Workbook as an Alternative to an Add-In.
26. Case Study: Designing an Excel Application.
About Tushar Mehta.
Using Excel for More Than Number Crunching.
Implementing the Solution in Excel and VBA.
Bill Jelen "Mr. Excel" is an accomplished Excel author and the principal behind the leading Excel website, MrExcel.com. As an Excel consultant, he has written Excel VBA solutions for hundreds of clients around the English-speaking world. His website hosts over 10 million page views annually. Prior to founding MrExcel.com, Jelen spent twelve years in the trenches, working as a financial analyst for finance, marketing, accounting and operations departments of a $500 million public company.
Tracy Syrstad works as an Excel and Access Consultant. As part of the Mr.Excel.com Consulting team, she has helped develop VBA solutions for clients around the world. She remembers the painful trek up the VBA learning curve while developing applications for co-workers at a former job. She is co-editor of Holy Macro!, it¿s ֿ,600 Excel VBA Examples CD” and editor of Dreamboat On Word.
Textul de pe ultima copertă
Everyone is looking for ways to save money these days. That can be hard to do for businesses that have complex needs, such as custom software applications. However, "VBA and Macros for Microsoft Excel" can teach you ways to customize pre-existing software to meet your specific needs. A variety of topics are covered that are sure to give you a solid knowledge of the VBA language. Event programming, user forms, carts, pivot tables, multi-dimensional arrays and Web queries are just a few of the areas you will learn about in this book. Written by the principal behind the leading Excel Web site, www.mrexcel.com, this book is sure to save you time and money!