Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
VBA Automation for Excel 2019 Cookbook

You're reading from   VBA Automation for Excel 2019 Cookbook Solutions to automate routine tasks and increase productivity with Excel and other MS Office applications

Arrow left icon
Product type Paperback
Published in Sep 2020
Publisher Packt
ISBN-13 9781789610031
Length 362 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Mike Van Niekerk Mike Van Niekerk
Author Profile Icon Mike Van Niekerk
Mike Van Niekerk
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Chapter 1: Getting Started with VBA 2. Chapter 2: Working with the VBA Editor FREE CHAPTER 3. Chapter 3: The VBA Object Model 4. Chapter 4: Working with Procedures 5. Chapter 5: Next Level Recording 6. Chapter 6: VBA Language Elements 7. Chapter 7: Working with Ranges 8. Chapter 8: Using Functions 9. Chapter 9: Implementing Program Flow 10. Chapter 10: Implementing Automation 11. Chapter 11: Handling Errors 12. Chapter 12: Debugging 13. Chapter 13: Creating and Modifying Dialog Boxes 14. Chapter 14: Creating UserForms 15. Chapter 15: UserForm Controls 16. Chapter 16: Creating Custom Functions 17. Chapter 17: Creating Word Documents with Excel VBA 18. Chapter 18: Working with PowerPoint in Excel VBA 19. Other Books You May Enjoy

Inserting the form

Unlike macros, UserForms are not created in newly inserted modules. They live elsewhere, which is what we're going to work on now.

In this recipe, we will be inserting a UserForm in the VBA Editor.

Getting ready

Open Excel and activate a new workbook. Save the file as a macro-enabled file on your desktop and call it UserForms.xlsm. Sheet1 should be active.

How to do it…

Let's insert our first UserForm using the following steps:

  1. Enter the following data into Sheet1. We will be creating a form to later add more data to this list:

    Figure 14.1 – Data on Sheet1

  2. Press Alt + F11 to switch to the VBA Editor.
  3. Right-click somewhere in the Project Explorer. From the pop-up menu that appears, select Insert, then click on UserForm:

    Figure 14.2 – Inserting a UserForm

  4. A blank UserForm1 window will appear to the right, and an icon for UserForm1 will appear in the Project Explorer:

    Figure 14.3 – Newly inserted...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime