Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Excel Tutorial
  • Excel Formulas
  • Excel Shortcut Keys
  • Data Analysis in Excel
  • Formatting in Excel
  • Excel Workbooks
  • Statistical Functions
  • Data Visualization in Excel
  • Pivot Tables in Excel
  • MS Excel Quiz
  • Excel Interview Questions
  • Advance Excel
Open In App
Next Article:
How to Delete a Sheet in Microsoft Excel
Next article icon

How to Delete a Module in Excel VBA?

Last Updated : 07 Mar, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

Have you ever seen a text file in a notepad or a source code file in visual studio code? These all are just basic files where you can write some code or information. Similarly, we have modules in excel, each module has its code window, where you can write some code and allow it to automate your repetitive tasks. There can be multiple modules. We can create, rename or delete a module in just a few mouse clicks. In this article, we will learn how to create and delete a module in excel VBA. 

Module and its types

A module is a set of instructions written in a VBA editor. There are broadly 5 types of modules in VBA: 

  1. General-Purpose Module: It is the simplest type of module. If we record a macro that will get stored in a module. This is called a general-purpose module. We can simply write code in the VBA editor also.
  2. Workbook Module: Workbook module handles the events happening at a workbook level. For example, opening, closing or renaming a workbook.
  3. Worksheet Module: The worksheet module is driven by the events happening at the worksheet level. For example, activating a worksheet or flipping between different worksheets. Automating the task such as merging the worksheets. 
  4. Userform Module: Userform Module is a way to input a piece of information from the user.  It is one of the most useful tools of VBA. 
  5. Class Module: It’s similar to the classes in other languages. We create our objects. VBA has built-in objects such as the Collection, Workbook, etc. The inheritance in VBA is minimal and much more restricted than in other languages. 

Creating a VBA module

Following are the steps to create a VBA module,

Step 1: Go to Developer Tab, and select Visual Basic in the menu bar. 

Selecting-visual-basic

Step 2: A VBA editor appears. We can see the information on all the worksheets and workbooks in the editor tab. 

Workbook-and-worksheets

Step 3: Go to Insert Tab and select Module. 

Selecting-module

Step 4: A module name module1 is created.

Module-1-created

Deleting a VBA module

Following are the steps to delete a VBA module,

Step 1:  Given 3 modules name module1, module2, and module3. Delete module3 from the Modules. 

Deleting-module-3

Step 2: Right-click on module3 and click on Remove module3. A dialogue box appears. 

Removing-module

Step 3: The dialogue box tells whether you want to export the given module or not. If you, do not want to save the module on your PC, then click on No.

Dialogue-box

Step 4: Module3 has been deleted from the VBA editor. 

Module3-deleted



Next Article
How to Delete a Sheet in Microsoft Excel
author
gautamgoel962
Improve
Article Tags :
  • Excel
  • Geeks Premier League
  • Microsoft Office
  • News
  • Excel-VBA
  • ExcelGuide
  • Geeks-Premier-League-2022

Similar Reads

  • How to Run Code from a Module in Excel VBA
    VBA Macro is for developers. In Excel, the macro is a piece of code written in VBA and VBA is Microsoft's programming language, it stands for Visual Basic for Applications. The module is a file with a .bcf extension that stores the code written in the Visual Basic for Applications editor. Let's lear
    4 min read
  • How to Delete Pages in Excel
    In Excel, the concept of "pages" typically refers to worksheets, print areas, or extra blank spaces that may clutter your file. Whether you’re looking to clean up your workbook, remove unwanted sheets, or delete unnecessary print areas, knowing how to delete pages in Excel is essential for maintaini
    3 min read
  • How to Delete a Sheet in Microsoft Excel
    Ever tried to manage your sheets in MS Excel? Keeping your data and sheets managed is a good idea of making your sheets well organized sometimes you also need to edit, organize and delete your sheets. In the case you are managing your sheets in a proper manner then you will need to delete some sheet
    4 min read
  • How to Enable & Run a Macro in Excel? 6 Ways
    We can record a macro in Excel or write from scratch in VB Editor. Excel provides different options to run a macro. In this article, we explore four different approaches to running a macro in an Excel application. Even while executing an Excel macro is a straightforward process for seasoned users, i
    5 min read
  • How to Add a Comment in a VBA in Excel?
    VBA Macro is for developers. Macro is a piece of code written in VBA. VBA is Microsoft's programming language and it stands for Visual Basic for Applications. Let's see how to set up our VBA Macro and how to add comments in a VBA in Excel. VBA Macro Excel is a very advanced tool that contains thousa
    4 min read
  • How to Round With Doubles in Excel VBA
    The round function is used to round the floating numbers to a particular decimal value. Rounding a number, where it has a long decimal value will give a good balance between accuracy and readability. It also helps in calculation and also to get a precise result. In real life, it is useful in doing m
    5 min read
  • How to Insert and Run VBA Code in Excel?
    In Excel VBA stands for (Visual Basic for Application Code) where we can automate our task with help of codes and codes that will manipulate(like inserting, creating, or deleting a row, column, or graph) the data in a worksheet or workbook. With the help of VBA, we can also automate the task in exce
    2 min read
  • How to Delete a Table in Google Docs
    How to Delete a Table in Google Docs - Quick StepsOpen Google DocsSelect the Table > Perform Right-clickSelect Delete Table >> Table DeletedTables in Google Docs are incredibly useful for organizing data, creating structured layouts, and displaying information clearly. However, as your docu
    9 min read
  • How to Delete Blank Columns in Excel
    Empty columns in your Excel spreadsheet can make it look messy and also look unprofessional. Now, whether you are doing a budget analysis, sorting data, or making a report, removing blank columns is a way to make your report professional and cleaner. Now, if you are new to MS Excel and want to know
    5 min read
  • How to Find and Remove Duplicates in Excel
    Removing duplicates in Excel is essential when cleaning up data to ensure accuracy and avoid redundancy. Whether you’re working with small datasets or large spreadsheets, Excel provides built-in tools and methods to help you identify and remove duplicates effectively. This guide will walk you throug
    9 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences