Excel VBA Programming For Dummies, 3rd Edition
Published by
John Wiley & Sons, Inc.
111 River Street
Hoboken, NJ 07030-5774
Copyright 2013 by John Wiley & Sons, Inc., Hoboken, New Jersey
Published by John Wiley & Sons, Inc., Hoboken, New Jersey
Published simultaneously in Canada
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, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions .
Trademarks: Wiley, the Wiley logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United States and other countries, and may not be used without written permission. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read. FULFILLMENT OF EACH COUPON OFFER IS THE SOLE RESPONSIBILITY OF THE OFFEROR.
For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
For technical support, please visit .
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at .
Library of Congress Control Number: 2012956413
ISBN 978-1-118-49037-2 (pbk); ISBN 978-1-118-49038-9 (ePub); ISBN 978-1-118-49181-2 (eMobi); ISBN 978-1-118-49174-4 (ePDF)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
About the Author
John Walkenbach is the best-selling author of more than 50 spreadsheet books and lives in southern Arizona. When hes not using Excel, hes probably playing clawhammer banjo.
Dedication
Sub Book_Dedication()
name = Application.UserName
reason = InputBox("What makes " & name & " so special?")
msg = "This book is dedicated to " & name
msg = msg & " because " & reason
MsgBox msg, vbInformation, "Dedication"
End Sub
Authors Acknowledgments
Im grateful to all the talented people at Wiley Publishing for giving me the opportunity to write Excel books. Special thanks to Kelly Ewing (project editor) and Niek Otten (technical editor). They certainly made my job easier.
Publisher's Acknowledgments
We're proud of this book; please send us your comments at http://dummies.custhelp.com
. For other comments, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
Some of the people who helped bring this book to market include the following:
Acquisitions and Editorial
Project Editor: Kelly Ewing
(Previous Edition: Colleen Totz Diamond)
Senior Acquisitions Editor: Katie Mohr
Technical Editor: Niek Otten
Editorial Manager: Jodi Jensen
Editorial Assistant: Anne Sullivan
Sr. Editorial Assistant: Cherie Case
Cover Photo: Konstantin Inozemtsev/ iStockphoto
Composition Services
Project Coordinator: Katherine Crocker
Layout and Graphics: Jennifer Creasey, Christin Swinford
Proofreaders: Melissa Cossell, Jessica Kramer, Tricia Liebig, Rob Springer
Indexer: BIM Indexing & Proofreading Services
Publishing and Editorial for Technology Dummies
Richard Swadley, Vice President and Executive Group Publisher
Andy Cummings, Vice President and Publisher
Mary Bednarek, Executive Acquisitions Director
Mary C. Corder, Editorial Director
Publishing for Consumer Dummies
Kathleen Nebenhaus, Vice President and Executive Publisher
Composition Services
Debbie Stailey, Director of Composition Services
G reetings, prospective Excel programmer....
Thanks for buying my book. I think youll find that it offers a fast, enjoyable way to discover the ins and outs of Microsoft Excel programming. Even if you dont have the foggiest idea of what programming is all about, this book can help you make Excel jump through hoops in no time (well, it will take some time).
Unlike most programming books, this one is written in plain English, and even normal people can understand it. Even better, its filled with information of the just the facts, maam variety and not the drivel you might need once every third lifetime.
Go to any large bookstore (in-person or online), and youll find many Excel books (far too many, as far as Im concerned). A quick overview can help you decide whether this book is really right for you. This book