Excel Macros For Dummies. Dick KusleikaЧитать онлайн книгу.
names and transactions
Budgeting and forecasting
Analyzing scientific data
Creating invoices and other forms
Developing charts from data
The list could go on and on. The point is simply that Excel is used for a wide variety of tasks, and everyone reading this book has different needs and expectations regarding Excel. One thing most readers have in common, however, is the need to automate some aspect of Excel, which is what macros (and this book) are all about.
About This Book
This book approaches the topic of Excel macros with the recognition that programming VBA takes time and practice — time that you may not have right now. In fact, many analysts don’t have the luxury of taking a few weeks to become expert at VBA. So instead of the same general overview of VBA topics, this book provides some of the most commonly used real-world Excel macros.
Each section in the book outlines a common problem and provides an Excel macro to solve the problem — along with a detailed explanation of how the macro works and where to use it.
Each section presents the following:
The problem
The macro solution
How the macro works
After reading each section, you'll be able to
Immediately implement the required Excel macro
Understand how the macro works
Reuse the macro in other workbooks or with other macros
The macros in this book are designed to get you up and running with VBA in the quickest way possible. Each macro tackles a common task that benefits from automation. The idea here is to learn through application. This book is designed so that you can implement the macro while getting a clear understanding of what the macro does and how it works.
Foolish Assumptions
I make three assumptions about you as the reader:
You've installed Microsoft Excel.
You have some familiarity with the basic concepts of data analysis, such as working with tables, aggregating data, creating formulas, referencing cells, filtering, and sorting.
You have an Internet connection so you can download the sample files.
Icons Used in This Book
Tip icons cover tricks or techniques related to the current discussion.
Remember icons indicate notes or asides that are important to keep in mind.
Warning icons hold critical information about pitfalls you will want to avoid.
The icons marks particuarly geeky parts of Excel and VBA. If you’re into the technical aspects, read on. If you’re not, you can completely skip paragraphs marked with this paragraph and still get your macros to work.
Beyond the Book
In addition to the material in the print or e-book you’re reading, this product comes with more online goodies:
Sample files: Each macro in this book has an associated sample file that enables you to see the macro working and to review the code. You can use the sample files also to copy and paste the code into your environment (as opposed to typing each macro from scratch). Download the sample files at:www.dummies.com/go/excelmacrosfd3e
Each macro in this book has detailed instructions on where to copy and paste the code. In general terms, you open the sample file associated with the macro, open the Visual Basic Editor (by pressing Alt+F11), and copy the code. Then open your workbook, open the Visual Basic Editor, and paste the code in the appropriate location. Note that in some macros, you need to change the macro to suit your situation. For example, in the macro that prints all workbooks in a directory (see Chapter 4), you point to the C:\Temp\ directory. Before using this macro, you must edit it to point to your target directory. If a macro is not working for you, most likely a component of the macro needs to be changed. Pay special attention to range addresses, directory names, and any other hard-coded names.
Cheat sheet: The cheat sheet offers shortcut keys that can help you work more efficiently in Excel's Visual Basic Editor. You can find the cheat sheet by visiting www.dummies.com
and searching for “Excel Macros Cheat Sheet.”
Where to Go from Here
If you’re completely new to Excel macros, start with Part 1 (Chapters 1–3) to get the fundamentals you need to understand the macros in this book. There, you gain a concise understanding of how macros and VBA work, along with the basic foundation you need to implement the macros provided in this book.
If you’ve got some macro experience and want to dive right into the macro examples, feel free to peruse Chapters 4–9 and search for the task or macro that looks interesting to you. Don’t worry. Each macro example stands on its own within its own section that gives you all the guidance you need to understand and implement the code in your own workbook.
Visit Part 2 if you’re interested in macros that automate common workbook and worksheet tasks to save time and gain efficiencies.
Explore Part 3 to find macros that navigate ranges, format cells, and manipulate the data in your workbooks.
If you want to find macros that work with PivotTables, charts, and emails, thumb through the macros in Part 4 where you discover macros that automate redundant PivotTable and chart tasks, as well as macros that send emails and connect to external data sources.
Don’t forget to hit Part 5 for some useful tips and advice on how to get the most out of your new macro skills.
Here are some final things to keep in mind while working with the macros in this book:
Any file that contains a macro must have the .xlsm file extension. See the section on macro-enabled file extensions in Chapter 1 for more information.
Excel does not run macros until they are enabled. As you implement these macros, you and your customers must comply with Excel’s macro security measures. See the section in Chapter