LICENSE, DISCLAIMER OF LIABILITY, AND LIMITED WARRANTY
By purchasing or using this book (the Work), you agree that this license grants permission to use the contents contained herein, but does not give you the right of ownership to any of the textual content in the book or ownership to any of the information or products contained in it. This license does not permit uploading of the Work onto the Internet or on a network (of any kind) without the written consent of the Publisher. Duplication or dissemination of any text, code, simulations, images, etc. contained herein is limited to and subject to licensing terms for the respective products, and permission must be obtained from the Publisher or the owner of the content, etc., in order to reproduce or network any portion of the textual material (in any media) that is contained in the Work.
MERCURY LEARNING AND INFORMATION (MLI or the Publisher) and anyone involved in the creation, writing, or production of the companion disc, accompanying algorithms, code, or computer programs (the software), and any accompanying Web site or software of the Work, cannot and do not warrant the performance or results that might be obtained by using the contents of the Work. The author, developers, and the Publisher have used their best efforts to insure the accuracy and functionality of the textual material and/or programs contained in this package; we, however, make no warranty of any kind, express or implied, regarding the performance of these contents or programs. The Work is sold as is without warranty (except for defective materials used in manufacturing the book or due to faulty workmanship).
The author, developers, and the publisher of any accompanying content, and anyone involved in the composition, production, and manufacturing of this work will not be liable for damages of any kind arising out of the use of (or the inability to use) the algorithms, source code, computer programs, or textual material contained in this publication. This includes, but is not limited to, loss of revenue or profit, or other incidental, physical, or consequential damages arising out of the use of this Work.
The companion files on the disc are also available for down load by writing to the publisher at .
The sole remedy in the event of a claim of any kind is expressly limited to replacement of the book, and only at the discretion of the Publisher. The use of implied warranty and certain exclusions vary from state to state, and might not apply to the purchaser of this product.
Copyright 2017 by MERCURY LEARNING AND INFORMATION LLC. All rights reserved.
This publication, portions of it, or any accompanying software may not be reproduced in any way, stored in a retrieval system of any type, or transmitted by any means, media, electronic display or mechanical display, including, but not limited to, photocopy, recording, Internet postings, or scanning, without prior permission in writing from the publisher.
Publisher: David Pallai
MERCURY LEARNING AND INFORMATION
22841 Quicksilver Drive
Dulles, VA 20166
www.merclearning.com
800-232-0223
This book is printed on acid-free paper.
Julitta Korol. Microsoft Excel 2016 Programming by Example with VBA, XML, and ASP.
ISBN: 978-1-942270-85-0
The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products. All brand names and product names mentioned in this book are trademarks or service marks of their respective companies. Any omission or misuse (of any kind) of service marks or trademarks, etc. is not an attempt to infringe on the property of others.
Library of Congress Control Number: 2016940551
161718321 Printed in the United States of America
Our titles are available for adoption, license, or bulk purchase by institutions, corporations, etc. For additional information, please contact the Customer Service Dept. at 800-232-0223(toll free).
All of our titles are available in digital format at .
The sole obligation of MERCURY LEARNING AND INFORMATION to the purchaser is to replace the disc, based on defective materials or faulty workmanship, but not based on the operation or functionality of the product.
To my husband, Paul
CONTENTS
F irst, Id like to express my gratitude to everyone at Mercury Learning and Information. A sincere thank-you to my publisher, David Pallai, for offering me the opportunity to update this book to the new 2016 version and tirelessly keeping things on track during this long project.
A whole bunch of thanks go to the editorial team for working so hard to bring this book to print. In particular, I would like to thank the copyeditor, IBI Prepress, for the thorough review of my writing. To Jennifer Blaney, for her production expertise and keeping track of all the edits and file processing issues. To the compositor, AllZone Digital Services Ltd., for all the typesetting efforts that gave this book the right look and feel.
Special thanks to my husband, Paul, for his patience during this long project and for having to put up with frequent takeout dinners.
Finally, Id like to acknowledge readers like you who cared enough to post reviews of the previous edition of this book online. Your invaluable feedback has helped me raise the quality of this work by including the material that matters to you most. Please continue to inspire me with your ideas and suggestions.
I f you ever wanted to open a new worksheet without using built-in commands or create a custom, fully automated form to gather data and store the results in a worksheet, youve picked up the right book. This book shows you whats doable with Microsoft Excel 2016 beyond the standard user interface. This books purpose is to teach you how to delegate many time-consuming and repetitive tasks to Excel by using its built-in language, VBA (Visual Basic for Applications). By executing special commands and statements and using a number of Excels built-in programming tools, you can work smarter than you ever thought possible. I will show you how.
When I first started programming in Excel (circa 1990), I was working in a sales department and it was my job to calculate sales commissions and send the monthly and quarterly statements to our sales representatives spread all over the United States. As this was a very time-consuming and repetitive task, I became immensely interested in automating the whole process. In those days it wasnt easy to get started in programming on your own. There werent as many books written on the subject; all I had was the built-in documentation that was hard to read. Nevertheless, I succeeded; my first macro worked like magic. It automatically calculated our sales commissions and printed out nicely formatted statements. And while the computer was busy performing the same tasks over and over again, I was free to deal with other more interesting projects.
Many years have passed since that day, and Excel is still working like magic for me and a great number of other people who took time to familiarize themselves with its programming interface. If youd like to join these people and have Excel do magical things for you as well, this book provides an easy step-by-step introduction to VBA and other hot technologies that work nicely with Microsoft Excel. One is known as classic ASP (short for Active Server Pages) and the other is XML (or Extensible Markup Language). Besides this book, there is no extra cost to you; all the tools you need are built into Excel. If you have not yet discovered them,