Introduction |
|
1 | (4) |
|
|
1 | (1) |
|
|
2 | (1) |
|
|
2 | (1) |
|
How This Book Is Organized |
|
|
2 | (2) |
|
Part I Getting Started with Excel Macros |
|
|
3 | (1) |
|
Part II Working with Workbooks |
|
|
3 | (1) |
|
Part III Automating Worksheet Tasks with Macros |
|
|
3 | (1) |
|
Part IV Selecting and Modifying Ranges |
|
|
3 | (1) |
|
|
3 | (1) |
|
Part VI Working with PivotTables |
|
|
3 | (1) |
|
Part VII Manipulating Charts with Macros |
|
|
3 | (1) |
|
Part VIII E-Mailing from Excel |
|
|
4 | (1) |
|
Part IX Integrating Excel and Other Office Applications |
|
|
4 | (1) |
|
|
4 | (1) |
|
|
4 | (1) |
|
About the Companion Website |
|
|
4 | (1) |
|
Part I Getting Started with Excel Macros |
|
|
5 | (32) |
|
Becoming Familiar with Macro Recording Basics |
|
|
7 | (4) |
|
Comparing Absolute and Relative Macro Recording |
|
|
11 | (4) |
|
Recording macros with absolute references |
|
|
11 | (2) |
|
Recording macros with relative references |
|
|
13 | (2) |
|
Looking at Other Macro Recording Concepts |
|
|
15 | (4) |
|
Macro-enabled file extensions |
|
|
15 | (1) |
|
Macro security in Excel 2010 |
|
|
16 | (1) |
|
|
16 | (1) |
|
Storing macros in your Personal Macro Workbook |
|
|
17 | (1) |
|
Assigning a macro to a button and other form controls |
|
|
17 | (2) |
|
Placing a macro on the Quick Access toolbar |
|
|
19 | (1) |
|
Working In the Visual Basic Editor |
|
|
19 | (2) |
|
|
19 | (1) |
|
Understanding VBE components |
|
|
19 | (2) |
|
Working with the Project window |
|
|
21 | (3) |
|
|
22 | (1) |
|
|
23 | (1) |
|
Working with a Code Window |
|
|
24 | (3) |
|
Minimizing and maximizing windows |
|
|
24 | (1) |
|
Getting VBA code into a module |
|
|
25 | (2) |
|
Customizing the VBA Environment |
|
|
27 | (4) |
|
|
27 | (2) |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
31 | (1) |
|
Discovering the Excel Object Model |
|
|
31 | (3) |
|
|
31 | (1) |
|
Understanding collections |
|
|
32 | (1) |
|
|
33 | (1) |
|
|
33 | (1) |
|
Taking a Brief Look at Variables |
|
|
34 | (1) |
|
About the Macros in This Book |
|
|
35 | (2) |
|
|
35 | (1) |
|
|
35 | (1) |
|
|
36 | (1) |
|
Part II Working with Workbooks |
|
|
37 | (34) |
|
Macro 1 Creating a New Workbook from Scratch |
|
|
39 | (2) |
|
|
39 | (1) |
|
|
40 | (1) |
|
Macro 2 Saving a Workbook when a Particular Cell Is Changed |
|
|
41 | (2) |
|
|
41 | (1) |
|
|
42 | (1) |
|
Macro 3 Saving a Workbook before Closing |
|
|
43 | (3) |
|
|
43 | (1) |
|
|
44 | (2) |
|
Macro 4 Protect a Worksheet on Workbook Close |
|
|
46 | (2) |
|
|
46 | (1) |
|
|
46 | (2) |
|
Macro 5 Unprotect a Worksheet on Workbook Open |
|
|
48 | (2) |
|
|
48 | (1) |
|
|
48 | (2) |
|
Macro 6 Open a Workbook to a Specific Tab |
|
|
50 | (2) |
|
|
50 | (1) |
|
|
50 | (2) |
|
Macro 7 Opening a Specific Workbook Defined by the User |
|
|
52 | (2) |
|
|
52 | (1) |
|
|
53 | (1) |
|
Macro 8 Determine Whether a Workbook Is Already Open |
|
|
54 | (3) |
|
|
54 | (2) |
|
|
56 | (1) |
|
Macro 9 Determine Whether a Workbook Exists in a Directory |
|
|
57 | (2) |
|
|
57 | (1) |
|
|
58 | (1) |
|
Macro 10 Refresh All Data Connections in Workbook on Open |
|
|
59 | (2) |
|
|
59 | (1) |
|
|
59 | (2) |
|
Macro 11 Close all Workbooks at Once |
|
|
61 | (2) |
|
|
61 | (1) |
|
|
61 | (2) |
|
Macro 12 Open All Workbooks in a Directory |
|
|
63 | (2) |
|
|
63 | (1) |
|
|
64 | (1) |
|
Macro 13 Print all Workbooks in a Directory |
|
|
65 | (2) |
|
|
65 | (1) |
|
|
66 | (1) |
|
Macro 14 Preventing the Workbook from Closing until a Cell Is Populated |
|
|
67 | (2) |
|
|
67 | (1) |
|
|
68 | (1) |
|
Macro 15 Create a Backup of a Current Workbook with Today's Date |
|
|
69 | (2) |
|
|
69 | (1) |
|
|
70 | (1) |
|
Part III Automating Worksheet Tasks with Macros |
|
|
71 | (32) |
|
Macro 16 Add and Name a New Worksheet |
|
|
73 | (2) |
|
|
73 | (1) |
|
|
74 | (1) |
|
Macro 17 Delete All but the Active Worksheet |
|
|
75 | (2) |
|
|
75 | (1) |
|
|
76 | (1) |
|
Macro 18 Hide All but the Active Worksheet |
|
|
77 | (2) |
|
|
77 | (1) |
|
|
78 | (1) |
|
Macro 19 Unhide All Worksheets in a Workbook |
|
|
79 | (2) |
|
|
79 | (1) |
|
|
79 | (2) |
|
Macro 20 Moving Worksheets Around |
|
|
81 | (2) |
|
|
81 | (1) |
|
|
81 | (2) |
|
Macro 21 Sort Worksheets by Name |
|
|
83 | (2) |
|
|
83 | (1) |
|
|
84 | (1) |
|
Macro 22 Group Worksheets by Color |
|
|
85 | (2) |
|
|
85 | (1) |
|
|
86 | (1) |
|
Macro 23 Copy a Worksheet to a New Workbook |
|
|
87 | (1) |
|
|
87 | (1) |
|
|
87 | (1) |
|
Macro 24 Create a New Workbook for Each Worksheet |
|
|
88 | (2) |
|
|
88 | (1) |
|
|
89 | (1) |
|
Macro 25 Print Specified Worksheets |
|
|
90 | (2) |
|
|
90 | (1) |
|
|
90 | (2) |
|
Macro 26 Protect All Worksheets |
|
|
92 | (2) |
|
|
92 | (1) |
|
|
92 | (2) |
|
Macro 27 Unprotect All Worksheets |
|
|
94 | (2) |
|
|
94 | (1) |
|
|
95 | (1) |
|
Macro 28 Create a Table of Contents for Your Worksheets |
|
|
96 | (3) |
|
|
96 | (2) |
|
|
98 | (1) |
|
Macro 29 Zooming In and Out of a Worksheet with Double-Click |
|
|
99 | (2) |
|
|
99 | (1) |
|
|
100 | (1) |
|
Macro 30 Highlight the Active Row and Column |
|
|
101 | (2) |
|
|
101 | (1) |
|
|
102 | (1) |
|
Part IV Selecting and Modifying Ranges |
|
|
103 | (34) |
|
Macro 31 Selecting and Formatting a Range |
|
|
105 | (3) |
|
|
105 | (2) |
|
|
107 | (1) |
|
Macro 32 Creating and Selecting Named Ranges |
|
|
108 | (3) |
|
|
109 | (1) |
|
|
110 | (1) |
|
Macro 33 Enumerating Through a Range of Cells |
|
|
111 | (2) |
|
|
111 | (1) |
|
|
112 | (1) |
|
Macro 34 Select and Format All Named Ranges |
|
|
113 | (2) |
|
|
113 | (1) |
|
|
114 | (1) |
|
Macro 35 Inserting blank Rows in a Range |
|
|
115 | (2) |
|
|
115 | (1) |
|
|
116 | (1) |
|
Macro 36 Unhide All Rows and Columns |
|
|
117 | (1) |
|
|
117 | (1) |
|
|
117 | (1) |
|
Macro 37 Deleting blank Rows |
|
|
118 | (2) |
|
|
118 | (1) |
|
|
119 | (1) |
|
Macro 38 Deleting blank Columns |
|
|
120 | (2) |
|
|
120 | (1) |
|
|
121 | (1) |
|
Macro 39 Select and Format All Formulas in a Workbook |
|
|
122 | (3) |
|
|
122 | (1) |
|
|
123 | (2) |
|
Macro 40 Find and Select the First blank Row or Column |
|
|
125 | (3) |
|
|
125 | (2) |
|
|
127 | (1) |
|
Macro 41 Apply Alternate Color Banding |
|
|
128 | (2) |
|
|
128 | (1) |
|
|
129 | (1) |
|
Macro 42 Sort a Range on Double-Click |
|
|
130 | (2) |
|
|
130 | (1) |
|
|
131 | (1) |
|
Macro 43 Limit Range Movement to a Particular Area |
|
|
132 | (2) |
|
|
132 | (1) |
|
|
132 | (2) |
|
Macro 44 Dynamically Set the Print Area of a Worksheet |
|
|
134 | (3) |
|
|
134 | (1) |
|
|
134 | (3) |
|
|
137 | (50) |
|
Macro 45 Copy and Paste a Range |
|
|
139 | (2) |
|
|
139 | (1) |
|
|
140 | (1) |
|
Macro 46 Convert All Formulas in a Range to Values |
|
|
141 | (2) |
|
|
141 | (1) |
|
|
142 | (1) |
|
Macro 47 Perform the Text to Columns Command on All Columns |
|
|
143 | (4) |
|
|
144 | (2) |
|
|
146 | (1) |
|
Macro 48 Convert Trailing Minus Signs |
|
|
147 | (3) |
|
|
147 | (2) |
|
|
149 | (1) |
|
Macro 49 Trim Spaces from All Cells in a Range |
|
|
150 | (2) |
|
|
150 | (1) |
|
|
151 | (1) |
|
Macro 50 Truncate ZIP Codes to the Left Five |
|
|
152 | (3) |
|
|
152 | (2) |
|
|
154 | (1) |
|
Macro 51 Padding Cells with Zeros |
|
|
155 | (3) |
|
|
155 | (2) |
|
|
157 | (1) |
|
Macro 52 Replace blanks Cells with a Value |
|
|
158 | (3) |
|
|
158 | (2) |
|
|
160 | (1) |
|
Macro 53 Append Text to the Left or Right of Your Cells |
|
|
161 | (2) |
|
|
161 | (1) |
|
|
162 | (1) |
|
Macro 54 Create a Super Data Cleanup Macro |
|
|
163 | (3) |
|
|
163 | (2) |
|
|
165 | (1) |
|
Macro 55 Clean Up Non-Printing Characters |
|
|
166 | (2) |
|
|
166 | (1) |
|
|
167 | (1) |
|
Macro 56 Highlight Duplicates in a Range of Data |
|
|
168 | (2) |
|
|
168 | (1) |
|
|
169 | (1) |
|
Macro 57 Hide All Rows but Those Containing Duplicate Data |
|
|
170 | (2) |
|
|
170 | (1) |
|
|
171 | (1) |
|
Macro 58 Selectively Hide AutoFilter Drop-down Arrows |
|
|
172 | (3) |
|
|
173 | (1) |
|
|
174 | (1) |
|
Macro 59 Copy Filtered Rows to a New Workbook |
|
|
175 | (2) |
|
|
175 | (1) |
|
|
176 | (1) |
|
Macro 60 Create a New Sheet for Each Item in an AutoFilter |
|
|
177 | (6) |
|
|
177 | (5) |
|
|
182 | (1) |
|
Macro 61 Show Filtered Columns in the Status Bar |
|
|
183 | (4) |
|
|
183 | (2) |
|
|
185 | (2) |
|
Part VI Working with PivotTables |
|
|
187 | (46) |
|
Macro 62 Create a Backwards-Compatible PivotTable |
|
|
189 | (3) |
|
|
190 | (1) |
|
|
191 | (1) |
|
Macro 63 Refresh All PivotTables Workbook |
|
|
192 | (2) |
|
|
192 | (1) |
|
|
193 | (1) |
|
Macro 64 Create a PivotTable Inventory Summary |
|
|
194 | (3) |
|
|
194 | (2) |
|
|
196 | (1) |
|
Macro 65 Make All PivotTables Use the Same Pivot Cache |
|
|
197 | (2) |
|
|
197 | (1) |
|
|
198 | (1) |
|
Macro 66 Hide All Subtotals in a PivotTable |
|
|
199 | (3) |
|
|
199 | (2) |
|
|
201 | (1) |
|
Macro 67 Adjust All Pivot Data Field Titles |
|
|
202 | (2) |
|
|
202 | (1) |
|
|
203 | (1) |
|
Macro 68 Set All Data Items to Sum |
|
|
204 | (3) |
|
|
204 | (2) |
|
|
206 | (1) |
|
Macro 69 Apply Number Formatting for All Data Items |
|
|
207 | (4) |
|
|
207 | (9) |
|
|
216 | |
|
Macro 70 Sort All Fields in Alphabetical Order |
|
|
211 | (2) |
|
|
211 | (1) |
|
|
212 | (1) |
|
Macro 71 Apply Custom Sort to Data Items |
|
|
213 | (2) |
|
|
213 | (1) |
|
|
214 | (1) |
|
Macro 72 Apply PivotTable Restrictions |
|
|
215 | (2) |
|
|
215 | (1) |
|
|
216 | (1) |
|
Macro 73 Apply Pivot Field Restrictions |
|
|
217 | (2) |
|
|
217 | (1) |
|
|
218 | (1) |
|
Macro 74 Automatically Delete Pivot Table Drill-Down Sheets |
|
|
219 | (4) |
|
|
219 | (2) |
|
|
221 | (2) |
|
Macro 75 Print Pivot Table for Each Report Filter Item |
|
|
223 | (3) |
|
|
223 | (2) |
|
|
225 | (1) |
|
Macro 76 Create New Workbook for Each Report Filter Item |
|
|
226 | (3) |
|
|
226 | (2) |
|
|
228 | (1) |
|
Macro 77 Transpose Entire Data Range with a PivotTable |
|
|
229 | (4) |
|
|
230 | (1) |
|
|
231 | (2) |
|
Part VII Manipulating Charts with Macros |
|
|
233 | (20) |
|
Macro 78 Resize All Charts on a Worksheet |
|
|
235 | (2) |
|
|
235 | (1) |
|
|
236 | (1) |
|
Macro 79 Align a Chart to a Specific Range |
|
|
237 | (2) |
|
|
237 | (1) |
|
|
238 | (1) |
|
Macro 80 Create a Set of Disconnected Charts |
|
|
239 | (2) |
|
|
239 | (1) |
|
|
240 | (1) |
|
Macro 81 Print All Charts on a Worksheet |
|
|
241 | (2) |
|
|
241 | (1) |
|
|
242 | (1) |
|
Macro 82 Label First and Last Chart Points |
|
|
243 | (3) |
|
|
243 | (2) |
|
|
245 | (1) |
|
Macro 83 Color Chart Series to Match Source Cell Colors |
|
|
246 | (4) |
|
|
246 | (3) |
|
|
249 | (1) |
|
Macro 84 Color Chart Data Points to Match Source Cell Colors |
|
|
250 | (3) |
|
|
250 | (2) |
|
|
252 | (1) |
|
Part VIII E-Mailing from Excel |
|
|
253 | (20) |
|
Macro 85 Mailing the Active Workbook as an Attachment |
|
|
255 | (3) |
|
|
255 | (2) |
|
|
257 | (1) |
|
Macro 86 Mailing a Specific Range as Attachment |
|
|
258 | (2) |
|
|
258 | (1) |
|
|
259 | (1) |
|
Macro 87 Mailing a Single Sheet as an Attachment |
|
|
260 | (2) |
|
|
260 | (1) |
|
|
261 | (1) |
|
Macro 88 Send Mail with a Link to Our Workbook |
|
|
262 | (2) |
|
|
262 | (1) |
|
|
263 | (1) |
|
Macro 89 Mailing All E-Mail Addresses in Our Contact List |
|
|
264 | (2) |
|
|
264 | (1) |
|
|
265 | (1) |
|
Macro 90 Saving All Attachments to a Folder |
|
|
266 | (3) |
|
|
266 | (2) |
|
|
268 | (1) |
|
Macro 91 Saving Certain Attachments to a Folder |
|
|
269 | (4) |
|
|
269 | (2) |
|
|
271 | (2) |
|
Part IX Integrating Excel and Other Office Applications |
|
|
273 | (29) |
|
Macro 92 Running an Access Query from Excel |
|
|
275 | (3) |
|
|
275 | (2) |
|
|
277 | (1) |
|
Macro 93 Running an Access Macro from Excel |
|
|
278 | (2) |
|
|
278 | (1) |
|
|
279 | (1) |
|
Macro 94 Opening an Access Report from Excel |
|
|
280 | (2) |
|
|
280 | (1) |
|
|
281 | (1) |
|
Macro 95 Opening an Access Form from Excel |
|
|
282 | (2) |
|
|
282 | (1) |
|
|
283 | (1) |
|
Macro 96 Compacting an Access Database from Excel |
|
|
284 | (2) |
|
|
284 | (1) |
|
|
285 | (1) |
|
Macro 97 Sending Excel Data to a Word Document |
|
|
286 | (3) |
|
|
286 | (2) |
|
|
288 | (1) |
|
Macro 98 Simulating Mail Merge with a Word Document |
|
|
289 | (4) |
|
|
289 | (3) |
|
|
292 | (1) |
|
Macro 99 Sending Excel Data to a PowerPoint Presentation |
|
|
293 | (3) |
|
|
293 | (2) |
|
|
295 | (1) |
|
Macro 100 Sending All Excel Charts to a PowerPoint Presentation |
|
|
296 | (3) |
|
|
296 | (2) |
|
|
298 | (1) |
|
Macro 101 Convert a Workbook into a PowerPoint Presentation |
|
|
299 | (3) |
|
|
299 | (2) |
|
|
301 | (1) |
Index |
|
302 | |