Variables and Data Types in VBA Excel
Last Updated :
31 Mar, 2022
In a computer system, variables and data types are almost used in every program to store and represent data. Similarly, Excel VBA also has variables and data types to store and represent data and its type. In this article, we will learn about VBA variables, their scope, data types, and much more.
VBA Variables
VBA(Visual Basic for Application) variables are similar to other programming languages variables, they act as a container that is used to store data(integer, string, floats, etc). We can use the variables in the code at multiple places and executer the programs.
Defining Variables In VBA
VBA gives permission to define variables in two ways:
- Implicitly - In VBA, we can implicitly declare variables using the assignment(=) operator. All the variables that are implicitly declared in VBA are of type "Variant". The variant type variables required more memory space than usual variables. Example: label="gfg"
- Explicitly - Explicitly we can declare variables using "Dim" keyword. Explicit variable also reduces the naming conflicts and spelling mistakes. Example: Num as password
Syntax For VBA Variables
// macro definition
Sub VBA_Variable_Example ()
Dim <name>
End Sub
VBA Variables Rule:
- Its length should be less than 255 characters.
- No space is allowed between characters.
- It should not starts with an integer.
- Period(.) is not allowed in between the characters.
Allowed | Not Allowed |
gfg_article | gfg.article |
dataStructureCourse1 | 1CourseDataStructure |
geekforgeeks | geeks for geeks |
Example:
In this example, we will define a macro in excel, And we will enter the code inside that macro and execute the code to understand the working of VBA variables in excel.
Step 1: First, we will make our Developer option available in the Excel toolbar. For this, go to any of the tools(here, we are choosing Draw) and then right-click on it and select the "Customize the Ribbon.." option.
The excel will open pop-up options, there we need to check the Developer checkbox and click on OK. This will enable the Developer option and make it available in the excel top toolbar.
Step 2: In this step, we will declare our variable in the visual basic editor. For this go to Developer > Visual Basic Editor.
This will open the Visual Basic Code Editor, where we are required to write our VBA script.
Step 3: In this step, we will write our VBA scripts. For this, we will double click on ThisWorkbook under Microsoft excel objects in the left pan and open the editor and write the following code to it.
Sub VBA_Variable_GFG_Example()
Range("a1").Value = "Data Structure Course"
Range("b1").Value = "Data Structure Course"
Range("c1").Value = "Data Structure Course"
Var = "Data Structure Course"
Range("a3").Value = Var
Range("b3").Value = Var
Range("c3").Value = Var
End Sub
In the above, we can see without using variables if we want to make changes to the string "Data Structure Course" and add "GeeksForGeeks" before every string, we need to repeat it at three different places. But if we use a variable then we just need to change it at one place where we declare our variable. This will reduce the workload.
Sub VBA_Variable_GFG_Example()
Range("a1").Value = "Data Structure Course"
Range("b1").Value = "Data Structure Course"
Range("c1").Value = "Data Structure Course"
Var = "GeeksForGeeks - Data Structure Course"
Range("a3").Value = Var
Range("b3").Value = Var
Range("c3").Value = Var
End Sub
We will write this code in the VBS script editor and execute it. This will print the output string in the cells defined in the code.
Once, we execute it using the Run button, we will get the following output.
Scope Of VBA Variables
The scope of variables is determined when we declare the variable. In VBA, the scope tells where the variable may be used. There is three level of scopes of the variable:
1. Procedure Level: These are those variables that can be used within the procedure they are defined. A Procedure is either a Sub or a Function
Example: In this example, we will see the procedure level of the VBA variable's scope. For this open the VBA editor and write the following code to it.
Sub sub1()
Dim res As String
res = "The variable which can be used within the procedure they are defined in."
Range("a1").Value = res
End Sub
Once, we click on the Run button in the VBA editor, we will the output. The text will get printed to cell A1.
2. Module Level: It is also known as the Private Module Level. It can be used by any procedures within the same module. These variables must be declared outside of all the procedures, at the top of the module.
Example: In this example, we will look for the module scope of variables. For this, we will create a new module. We will open VBA Editor and in the left pane (project explorer) we will Right-Click and create a new module add the following code to it.
Dim txt As String
Sub ProcedureDemo()
txt = "A Sub or Function is a Procedure, variables defined inside them only accessible within them"
Range("a1").Value = txt
End Sub
Sub PrivateModuleDemo()
txt = "Variable which is define inside a module, are accessible by all the procedures within that module"
Range("a2").Value = txt
End Sub
After this, we just need to click on the Run button. Also, when we run it, it asks for which macros to run, there we need to choose "Macros In: <All Projects>".
Once we run it, we will get the output in cells A1 and A2.
3. Public Module Level: As the name suggests, the public module variables scope is at the Project level. If we define any variable as a public module variable it can be used in any module inside that project.
Example: In this example, we will add two different modules and define a public VBA variable inside one module and try to access it from both modules. Below is the code for module1 and module2.
Module1
Public res As String
Sub demo_1()
res = "geeks"
Range("a1").Value = res
End Sub
Module2
Sub demo_2()
res = "geeksforgeeks"
Range("a2").Value = res
End Sub
Once, done with both the modules. Just click on the Run button. The output will get printed in cells A1 and A2,
Fig 12 - Output
Lifetime Of Variable
The variables can retain their value up to their scope. The lifetime of a variable tells about how long a variable can retain its value. In order to extend the scope and so, the lifetime of a variable we need to declare the variable with a static keyword. If we declare a variable with a static keyword, the variables will retain their value even after all the macros are finished execution.
Example: In this example, we will define a variable using the static keyword and execute it multiple time to check whether it retains the value or not. We need to write the following code to the VBA Editor.
Sub StaticVariableDemo()
Static count As Integer
count = count + 1
MsgBox (count)
End Sub
After this, we need to execute it. Every time we will click on the run button the MessageBox will return the updated value. (1, 2, 3.....) and thus it will extend its scope and lifetime.
VBA Data Types
In computers, we use data types to differentiate between the integers and strings, etc. The data types which we will assign to a variable, decide what should be stored in that variable, i.e., the values that need to be stored in the variable is depends on the data type of the variable. In VBA, data types are divided into two major types:
1. Numeric Data Type: Numeric data types are used to perform mathematical operations such as addition, subtraction, etc. It is used to handle the numbers in various representations format. In numeric data type, the Integral Type represents only the whole numbers(zero, positive & negative). Non-Integral Types represent both the integer and the fractional part.
Data Types | Memory Size | Value Range |
Byte | 1 2yte | 0 to 255 |
Integer | 2 bytes | -32,768 to 32,767 |
Long | 4 bytes | -2,147,483,648 to 2,147,483,648 |
Single | 4 bytes | Negative Values (-3.402823E+38 to -1.401298E-45) & Positive Values (1.401298E-45 to 3.402823E+38) |
Double | 8 bytes | Negative Values (-1.79769313486232e+308 to -4.94065645841247E-324) & Positive Values (4.94065645841247E-324 to 1.79769313486232e+308) |
Currency | 8 bytes | -922,337,203,685,477.5808 to 922,337,203,685,477.5807 |
Decimal | 12 bytes | No Decimal Places (+/- 79,228,162,514,264,337,593,543,950,335) & Up to 28 Decimal Places (+/- 7.9228162514264337593543950335) |
2. Non-Numeric Data Type: Non-Numeric data types are not manipulated by the arithmetic operators. These are comprised of texts, data, etc.
Data Types | Memory Size | Value Range |
String(fixed size/length) | Equivalent to String's length(in bytes) | 1 to 65,400 characters |
String(variable length) | String's length + 10 bytes | 0 to 2 billion characters |
Boolean | 2 bytes | True/False |
Object | 4 bytes | Embedded object |
Data | 8 bytes | January 1, 100 to December 31, 9999 |
Variant(numeric) | 16 bytes | Any value |
Variant (text) | Text's length + 22 bytes | 0 to 2 billion characters |
Note: If we do not declare any data type, the VBA will be default makes variable as a variant type.
Example:
In this example, we will write a simple script to create a button and with one click of that button an event will occur and we will get the output.
Step 1: First we will insert a command button in our excel worksheet. For this go to Developer > Insert > Command Button and click on it.
Fig 14 - Command Button
After that, we can insert the button anywhere in the sheet we want. We just need to drag it over the excel sheet.
Step 2: In this step, we will write the script for our button. For this just double-click on the button. This will open the VBA Script Editor where we will write the following code. In the below code, we are defining GFG and course as String data type and res as Integer data type.
Private Sub CommandButton1_Click()
Dim GFG As String, res As Integer, course As String
GFG = "GeeksForGeeks"
res = "01"
course = "Interview Preparation"
Range("a1").Value = GFG
Range("b1").Value = res
Range("c1").Value = course
End Sub
Step 3: In this step, we will save our script. For this click on the Save button in the VBA Editor.
The excel will popup a window asking for saving the macros. We need to click "Yes" and it will save it.
Step 4: Now, we will execute our script. For this, we need to click over the command button. But before clicking over it, we are required to come out of Design Mode. To move out of any mode just click on mode once.
Once we are done with this, we will execute our script by clicking over the commandButton1. It will give the following output.
Note: If we write "01" in any cell in excel, it will print "1" by default. That's why the in output, in cell b1 only "1" is printed.
Similar Reads
MS Excel Tutorial - Learn Excel Online Free Excel, one of the powerful spreadsheet programs for managing large datasets, performing calculations, and creating visualizations for data analysis. Developed and introduced by Microsoft in 1985, Excel is mostly used in analysis, data entry, accounting, and many more data-driven tasks.Now, if you ar
11 min read
Excel Fundamental
Introduction to MS ExcelSince its first release in 1985, Microsoft Excel has received various updates and nowadays it is one of the most used spreadsheet programs. It is part of the Microsoft Office suite and offers a useful grid system to organize and analyze data easily.Here are some key features of Excel:Features a grid
8 min read
How to Download Microsoft Excel 2024/365 Edition on PC/Android/iOSMicrosoft Excel is one of the most powerful and widely used tools for managing data, creating reports, and performing calculations. Whether you're a student, professional, or business owner, having Excel on your PC, Android, or iOS device ensures you can stay productive on the go or at your desk. Th
8 min read
What is a Excel SpreadsheetIf you search only about Spreadsheet then you will find it is a computer applicaion that save, display, and manipulate data in rows and columns. In the year 1978 first spreadsheet program is developed by Daniel Bricklin and Bob Frankston named as VisiCalc. Now, in the recent year Microsoft Excel is
12 min read
Workbooks in Microsoft ExcelSpreadsheet programs have become essential for many organizations for analyzing and storing data and if we talk about the most recognized spreadsheet program, then it will be MS Excel. Now, if you have worked with Microsoft Excel, then you have heard about the terms workbooks and worksheets. In the
5 min read
Worksheets in ExcelIf you're new to MS Excel, you've likely heard the term "worksheet." But have you ever wondered what an Excel worksheet actually is? So, in a spreadsheet program, a worksheet is a collection of cells (it is a basic data unit in the worksheet) where you can store and manipulate data. By default, ever
5 min read
Workbooks in Microsoft ExcelSpreadsheet programs have become essential for many organizations for analyzing and storing data and if we talk about the most recognized spreadsheet program, then it will be MS Excel. Now, if you have worked with Microsoft Excel, then you have heard about the terms workbooks and worksheets. In the
5 min read
How to Delete All Rows Below Certain Row or Active Cell in ExcelExcel is a powerful data management tool that can be used to store, analyze, and create reports on large data. It is generally used by accounting professionals to analyze financial data but can be used by anyone to manage large data. But what if your Excel sheet is full of extra rows you donât need?
6 min read
How to Remove Hyperlinks in ExcelLooking for the steps to remove unwanted hyperlinks form your Excel worksheet? Then in this short article we are going to discuss 6 different ways to remove hyperlinks in Excel. The steps discussed in this article work in all Excel versions from 2023 to the latest version of Excel.Actually, the HYPE
6 min read
How to Use Fractions in ExcelMicrosoft Excel is a powerful tool for managing numbers, but did you know it can also handle fractions just as smoothly as decimals and whole numbers? If you are a newbie working with data where you need to use fractions, then this guide on how to use fractions will guide you on the practical ways t
6 min read
Excel Formatting
Data Formatting in ExcelData formatting in Excel is the key to transforming raw numbers into clear, professional, and actionable insights. From customizing dates and currencies to applying conditional formatting for quick analysis, mastering these techniques saves time and enhances your spreadsheetsâ impact. This guide wil
3 min read
How to Expand Cells to Fit the Text Automatically in ExcelWe all know how useful Excel is to store tabular data. We can do calculations in excel, we can store any information that is in the form of tables, and so on. But there are some common problems that we all face while using Excel. One of the problems that we encounter while entering oversized, overle
3 min read
Excel Date and Time Formats With ExamplesExcel stores dates as serial numbers and times as fractional values of a day, which means what you see on the surface is often just a formatted version of something else entirely. If you're not familiar with how Excel handles these values, your data might display incorrectly or unexpected results in
4 min read
How to Insert a Picture in a Cell in MS Excel?Every day in business or any other field lots of information are there that are required to store for future use. For anyone, it is very difficult to remember that information for a long time. Earlier data and information are stored in a form of a register, file, or by paperwork but finding it may b
4 min read
How to Unhide and Show Hidden Columns in Excel: Step by Step GuideThere are lots of times when you need to hide certain columns on a temporary basis so you can focus on the specific data. But knowing how to unhide the hidden columns is also important if you want to work on the hidden data again. This complete guide on how to unhide hidden columns in Excel will wal
9 min read
Conditional Formatting in Excel: Basic to Advanced GuideWhen handling large datasets in Excel, itâs easy to lose sight of what matters without clear visual cues. Conditional formatting in Excel solves this by highlighting key information. In this guide, weâll show you how to use conditional formatting to improve your spreadsheets with color scales, icon
9 min read
How to Apply Conditional Formatting Based On VLookup in Excel?VLOOKUP is an Excel function to lookup data in a table organized vertically. VLOOKUP supports approximate and exact matching, and wildcards (* ?) for partial matches.Conditional Formatting Based on Vlookup:1. Using the Vlookup formula to compare values in 2 different tables and highlighting those va
3 min read
How to Compare Two Columns and Delete Duplicates in ExcelFacing redundant data in your Excel and don't know how to compare two columns so you can easily de-duplicate Excel? Explore this guide to get the step-by-step instructions to compare two columns and delete duplicate data. Here you will learn multiple ways, like the equal operator, IF() function, and
3 min read
How to Find Duplicate Values in Excel Using VLOOKUPExcel is a great tool for working with data. One of its handy features is the VLOOKUP function, which helps you find matching or duplicate values in your data. In this article, weâll show you how to use VLOOKUP to spot duplicates in a simple way. Youâll learn how to compare two columns in one sheet,
3 min read
Excel Formula & Function
Basic Excel FormulasMicrosoft Excel offers a wide variety of built-in functions, which are predefined formulas that make working with data faster and easier. Whether you're calculating totals, finding averages, or analyzing a dataset, these functions can save you time and improve accuracy.If you're new to Excel or look
2 min read
How to Use Concatenate in ExcelUnlock the full potential of your data management skills by mastering how to use CONCAT Function in Excel. This powerful function allows you to seamlessly combine text from multiple cells into one, streamlining your workflow and making your spreadsheets more efficient. Whether you're preparing compl
7 min read
How to Calculate Percentage in Excel with Examples (2025 Updated)How to Get Percentage in Excel: Quick StepsSelect the Cell for the ResultEnter the Formula>>Press EnterFormat as Percentage Did you know that 90% of businesses rely on Excel for data analysis, and percentage calculations are one of the most frequently used features? Whether youâre tracking sal
9 min read
Excel LEFT, RIGHT, MID, LEN, and FIND FunctionsMastering Excel functions like LEFT, RIGHT, MID, LEN, and FIND is essential for anyone looking to manipulate and analyze text data effectively. These functions allow you to extract specific parts of text, measure text length, and find the position of characters within a string, making it easier to c
6 min read
Excel IF FunctionThe IF function in Excel is one of the most powerful and commonly used formulas that allows you to perform logical tests and return different values based on whether the condition is true or false. If youâve ever needed to check whether a value meets certain criteria, then the IF function is the too
12 min read
Excel VLOOKUP Function - Excel Guide for BeginnersHow to do VLOOKUP in Excel - Quick StepsPrepare Your DataEnter the VLOOKUP Formula >> Press EnterUse a Cell Reference for FlexibilityCopy the Formula for Multiple RowsAdding clickable links to your document is a simple yet powerful way to connect readers to external websites, email addresses,
15 min read
Dynamic Array Formulas in ExcelDynamic arrays are resizable arrays that calculate automatically and return value into multiple cells based on a formula entered in a single cell. The new array (multiple cells) that we get is known as spilling and the new array has been placed in neighboring cells. It is not necessary to use Ctrl +
2 min read
COUNTIF Function in Excel - Step by Step TutorialExcel Countif Function - Quick Steps Select the RangeDefine the CriteriaEnter the Formula =COUNTIF(range, criteria)Press EnterEver needed to quickly count cells that meet specific criteria in Excel? The COUNTIF function in Excel is your go-to tool for this task. Whether you're analyzing data, filter
9 min read
How To Use MATCH Function in Excel (With Examples)Finding the right data in large spreadsheets can often feel like searching for a needle in a haystack. This is where the MATCH function in Excel proves invaluable. The MATCH function helps you locate the position of a specific value within a row or column, making it a cornerstone of efficient data m
6 min read
Excel Data Analysis & Visualization
How to Sort by the Last Name in Excel?When you work on excel you'll probably be assigned a task to sort data alphabetically in ascending or descending order and it is quite an easy task to sort data using the first names in either of the order. It is the easiest task to be done in excel. But what if you are given a task to sort a list o
5 min read
How to Sort Data by Color in Excel?Sorting Data By Color allows us to segregate the data cells of a specific color. There can be many ways to sort by color like sorting by Cell color, sorting by Font color, etc. We can also add multiple levels in sorting data by color. Sorting by Color makes analysis very easy and time-saving. Sort b
3 min read
How to Swap Columns in Excel: 3 Methods ExplainedTo Swap Columns in Excel - Quick StepsDrag and Drop: Select a column, drag it to a new position, and release.Cut and Paste: Cut a column (Ctrl + X) for Windows and (Cmd + X) for Mac, then paste it in the new location using Insert Cut Cells.Copy and Paste: Copy a column, then insert the copied cells
8 min read
Sparklines in Excel : Add, Types, DeleteThe sparklines are also known as in-line charts. So the question is where do we use sparklines, we can use them in situations where we want the graph/chart to be as near to the data as possible. Mainly we write data in one row / one column and add a sparkline to the end of the row or end of the colu
10 min read
Pivot Tables in Excel - Step by Step GuidePivot tables are one of the important and useful Excelâs features that allows us to quickly summarize, analyze and explore large datasets whether itâs sales figures, financial reports or any complex data. A pivot table helps us to rearrange, group and calculate data easily to spot trends and pattern
5 min read
How to Sort a Pivot Table in Excel : A Complete GuideSorting a Pivot Table in Excel is a powerful way to organize and analyze data effectively. Whether you want to sort alphabetically, numerically, or apply a custom sort in Excel, mastering this feature allows you to extract meaningful insights quickly. This guide walks you through various Pivot Table
7 min read
Pivot Table Slicers in ExcelSlicers are visual filters in Excel that allow us to quickly and easily filter data in a Pivot Table or Pivot Chart by clicking on the items we want to see. Found in the Analyze tab of PivotTable Tools, they provide a more intuitive and user-friendly alternative to traditional drop-down filters. The
6 min read
Data Visualizations in Power ViewData visualization is a technique to represent the data or set of information in charts. Excel gives a tool of Power View where we can explore the data interactively and also we can visualize the data such that data can be presented in Tables, Bar charts, Scatter plots, and Pie charts. This tool can
3 min read
Chart Visualizations in Excel Power ViewPower View is an Excel Visualization tool that allows you to build visually appealing graphs and charts, dashboards for management, and reports that can be issued daily, weekly, or monthly. When we think of Microsoft Excel, we think of various tools such as Formulae, which makes an analyst's job sim
8 min read
Table Visualization in Excel Power ViewFor whatever visualization we decide to make with Power View, we start by generating a Table, which is the default, and then quickly convert the Table to other visualizations. The Table is formatted similarly to any other data table, with columns representing fields and rows representing data values
5 min read
Multiple Visualizations in Excel Power ViewPower View allows for interactive data exploration, visualization, and presentation, promoting easy ad hoc reporting. Power View's flexible visuals enable on-the-fly analysis of large data sets. The data visualizations are dynamic, making it easier to show the data with a single Power View report. M
4 min read
How to Create Dynamic Excel Dashboards Using Picklists?Dashboards are a report technique that visually presents critical metrics or a data summary to allow for quick and effective business decisions. Excel is capable of handling complex statistical calculations, many of which are built-in as Functions and can be easily displayed on a dashboard. Excel da
3 min read
Advanced Excel
How to Use Solver in Excel?A solver is a mathematical tool present in MS-Excel that is used to perform calculations by working under some constraints/conditions and then calculates the solution for the problem. It works on the objective cell by changing the variable cells any by using sum constraints. Solver is present in MS-
3 min read
Power Query â Source Reference as File Path in CellPower query helps in doing automation in an efficient manner. It allows users to utilize files stored in specific locations and apply routine transformation steps on those files. It allows users to embed file paths and file sources in an Excel cell. The end user can make use of named ranges and Exce
2 min read
How to Create Relational Tables in Excel?Excel directly doesn't provide us ready to use a database, but we can create one using relationships between various tables. This type of relationship helps us identify the interconnections between the table and helps us whenever a large number of datasets are connected in multiple worksheets. We ca
4 min read
How to Import, Edit, Load and Consolidate Data in Excel Power Query?Power Query is an easy and efficient way of solving simple data tasks. Most of our valuable time is frequently consumed by tedious manual procedures like cut and paste, column merging, and filtering. These operations are greatly simplified with the Power Query tool. A further advantage is that, in c
8 min read
Connecting Excel to SQLiteA tiny, quick, self-contained, highly reliable, fully-featured serverless, zero-configuration, transactional SQL database engine is implemented by SQLite, an in-process C language library. The most popular database engine worldwide is SQLite. The public domain status of SQLite's source code allows f
4 min read
Handling Integers in Advanced ExcelA table can be converted into a chart with the help of a power view where one column of data has to be aggregated. Power View can aggregate both integer and decimal numbers. We can also aggregate the data models by other default behavior. Power View provides Power View Fields where the sigma symbol
2 min read
Power Pivot for ExcelPower Pivot serves as an Excel add-on enabling robust data analysis and the creation of advanced data models. This tool facilitates the integration of extensive data from diverse sources, enabling swift information analysis and seamless sharing of insights. Whether working in Excel or Power Pivot, u
10 min read
Excel Power Pivot - Managing Data ModelPower Pivot is something that helps us in relating between two different data sets which are in two different worksheets. We can manage and relate any type of data using Power Pivot. It is used for data analysis and creates many different data models. we can collect large data from different sheets
6 min read
Table and Chart Combinations in Excel Power PivotFor data exploration, visualization, and reporting, Power Pivot offers a variety of Power PivotTable and Power PivotChart combinations. A Power PivotChart is a PivotChart that was made using the Power Pivot window and is based on the Data Model. Despite sharing certain functionality with Excel Pivot
3 min read
Excel Data Visualization
Advanced Excel - Chart DesignThe charts are the visual representation of data in both rows and columns. They are used to analyze the trends and patterns in the datasets. For example, If we want to analyze the sales of different courses for a specific period of time we can easily do this with the help of charts and get the resul
4 min read
How to Create a Graph in Excel: A Step-by-Step Guide for BeginnersAnyone who wants to quickly make observations and represent them graphically should know how to create graphs with Excel. Whether it is the preparation of business analysis papers, academic research documents or financial reports among other things, learning how to make graphs in Excel can significa
8 min read
Formatting Charts in ExcelOne of the major uses of Excel is to create different types of charts for a given data set. Excel provides us with a lot of modification options to perform on these charts to make them more insightful. In this article, we are going to see the most common "Formatting" performed on charts using a suit
3 min read
How to Create a Waterfall Chart in Excel Waterfall charts are a powerful visualization tool used to illustrate the cumulative effect of sequential data points, such as profits, losses, or changes over time. Widely used in financial and performance analysis, these charts provide clear insights into the contributions of individual components
6 min read
Scatter and Bubble Chart Visualization in ExcelScatter Charts and Bubble Charts display many related data in one Chart. In both of these charts, the X - axis displays one numeric field and the Y-axis displays another. It helps to specify the relationship between two values for all the items in the chart easily. In Bubble charts, a third numeric
5 min read
How to Create a Pie Chart in Excel - Step by Step Guide Pie charts are an excellent way to visualize proportions and illustrate how different components contribute to a whole. Whether you're analyzing market share, budget allocation, or survey results, pie charts make complex data easily understandable at a glance. This guide will walk you through how to
6 min read
How To Create A Pictograph In Excel?The Pictograph is the record consisting of pictorial symbols. Generally, in mathematics, it is represented by the help of graphs with pictures or icons representing certain quantities or numbers of people, books, etc. It is also known as pictogram, pictogramme, pictorial chart, picture graph, or sim
3 min read
How to make a 3 Axis Graph using Excel?3 Axis Graphs in Excel are the graphs that have three axis. The need for a three-axis arises when the scale of the values is very different. For example, you are given an atom and you want to make a graph between its diameter, melting point, and colloidal nature. If they are plotted on the same scal
7 min read
How To Create a Tornado Chart In Excel?Tornado charts are a special type of Bar Charts. They are used for comparing different types of data using horizontal side-by-side bar graphs. They are arranged in decreasing order with the longest graph placed on top. This makes it look like a 2-D tornado and hence the name. Creating a Tornado Char
2 min read
How to Create Flowchart in Excel: Step-by-Step GuideA Flowchart is a valuable tool for visualizing processes, workflows, or decision-making paths, making it easier to communicate ideas and identify improvements. This article provides a clear, step-by-step guide on how to create a Flowchart in Excel, using its shapes and formatting tools to design cus
6 min read
Excel VBA & Macros
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
Variables and Data Types in VBA ExcelIn a computer system, variables and data types are almost used in every program to store and represent data. Similarly, Excel VBA also has variables and data types to store and represent data and its type. In this article, we will learn about VBA variables, their scope, data types, and much more. VB
9 min read
How to Use the VBA Editor in Excel: Quick Guide 2024Unlock the full potential of Microsoft Excel by diving into the world of Visual Basic for Applications (VBA). The VBA Editor in Excel is a powerful tool that allows you to automate tasks, create custom functions, and streamline your workflow like never before. Whether you're looking to boost product
7 min read
VBA Strings in ExcelIn Excel's Visual Basic for Applications(VBA), strings are pivotal in handling and manipulating text-based data. Strings serve as a fundamental data type used to store a sequence of characters, enabling the representation of textual information, numbers, symbols, and more. Understanding how VBA hand
8 min read
VBA Find Function in ExcelIn an Excel sheet subset of cells represents the VBA Range which can be single cells or multiple cells. The find function will help to modify our search within its Range object. A specific value in the given range of cells is to search with the help of the Find function. Excel VBA provides different
5 min read
ActiveX Control in Excel VBAWhen we are automating an excel sheet with VBA at that time when the user has a requirement for a more flexible design then it's better to use ActiveX Controller. In Excel user has to add the ActiveX Controller manually and ActiveX Controls are used as objects in codes. There are the following types
3 min read
Multidimensional Arrays in Excel VBAMultidimensional Arrays are used to store data of similar data types of more than one dimension. A multidimensional array has a dimension up to 60 but usually, we don't use arrays of dimensions more than 3 or 4. Here, we will see how to declare a multidimensional array in many ways and also how to c
2 min read
VBA Error HandlingIn a VBA code, there may be some errors like syntax errors, compilation errors, or runtime errors so we need to handle these errors. Suppose there is a code of 200 lines and the code has an error it's very difficult to find an error in the code of 200 lines so it's better to handle the error where w
10 min read
How to Remove Duplicates From Array Using VBA in Excel?Excel VBA code to remove duplicates from a given range of cells. In the below data set we have given a list of 15 numbers in âColumn Aâ range A1:A15. Need to remove duplicates and place unique numbers in column B. Sample Data: Cells A1:A15 Sample Data Final Output: VBA Code to remove duplicates and
2 min read
Macros In Excel With Examples: Step-by-Step TutorialExcel macros are a powerful tool that can automate repetitive tasks, saving you time and increasing productivity. Whether you're trying to enable Excel macros, record a macro in Excel, or automate specific actions within your spreadsheet, macros are an invaluable feature. In this guide, we will walk
11 min read
Assigning Excel Macro to ObjectsIn Excel, a recorded macro can be assigned to different objects like a shape, graphic, or control note. Instead of running the macro from the required tool in ribbon, we can create these objects to run them easily. They get very handy when multiple macros are there. Individual objects can be created
3 min read
How to Enable Macros in Excel (2025): Step-by-Step GuideHow to Activate Macros in Excel - Quick StepsOpen the Excel workbook.Click Enable Content in the yellow security warning bar.Go to File > Options > Trust Center > Trust Center Settings > Macro Settings.Choose the desired macro setting (e.g., Enable All Macros for trusted files).Save the
9 min read
Power BI & Advance Features in Excel