×

VBA Charts

What is a Chart?

A chart is used to visually show numbers or data in a spreadsheet (or spread over multiple spreadsheets) so that the end-user can look at the chart and interpret the results or observe the trends easily.

Excel gives an advantage to the user to create customized charts, instantly displaying the data in a visually attractive manner for users. The user can easily manipulate the charts placed within a worksheet or a chart sheet. There are several types of charts in excel, unlike Column chart, Line chart, Bar chart, Stacked chart (bar, line, column), Pie chart, & Bubble charts with Column Bar being the most commonly used.

Charts are created either by directly working with the chart object that defines the chart data. In order to get to the object without an existing chart, you create a ChartObject on a given Worksheet and then get the Chart object from it.

Parts of a Charts

VBA Charts

A - Horizontal Axis: – It is also known as the X-axis. It consists of different values of the variable for which we are plotting data on the graph.

B - Primary Vertical Axis: – It is also known as Y-axis. It consists of a scale based on different data points we are plotting on the graph.

C - Secondary Vertical Axis:– It is not present in all the graphs and is used when we are plotting two different variables on the graph, and there is a huge value difference between the two variables – for example, we are plotting age and salary – age will be in 10’s multiples whereas Salary in 1,000’s – so if we plot them on the same Y-axis, age graph/line/data-points will not be visible at all.

D - Data-Points: – It represents the values that we are plotting on the graphs like age, salary, units, etc,.

E - Chart Title: – It represents the title of the chart, which you can change, link to a cell, or even can format as per your requirement.

F - Legend: – The legend is a sort of key. It informs the users regarding the values that have been plot on the graphs.

G - Data Label: – When you plot values on a graph, you may also want to see the values of each of these data-points, and these values are called Data Labels.

H - Title Axis: – It denotes the title for the horizontal and vertical axis, unlike in the above example we have used Name and Salary on our Title axis.

Embedded Charts vs Chart sheets

Embedded ChartsChart Sheets
These charts are set within a worksheet & and can be shown along with the data or any other informationChart sheets are represented as a separate sheet in the workbook. It contains only a single chart in which the source data or any other information is not displayed.
It can be seen together with other facts in a worksheet.It cannot be a part of the worksheet.
It is saved as part of the worksheet on which it is created.It is saved with is its own sheet name.
These charts are to display or print one or more charts within the worksheet.These charts are used to review or amend large or complicated charts individually from the worksheet data. It is also used when the user wants to preserve screen space to work upon the worksheet.

Related Topics

Excel VBA AutoFilter

One of the reasons for Excel VBA’s popularity is its capability to filter and analyze data from huge database with the help of a method known as AutoFilter. This method permits a...

4 minutes read.

Excel VBA Year Function

Excel VBA Year Function: The Year function in VBA returns the four-digit year for the specified date. Syntax Year (Date) Parameter Date (required) – This parameter represents the significant date. Return This function returns the four-digit year...

1 minute read.

VBA Updating Pivot Table

VBA- Updating Pivot Table The pivot table is an important feature to explore, summarize, and interpret the bulk amount of data. It helps data evaluating, reviewing, as well as making useful...

3 minutes read.

Excel VBA FormatNumber Function

VBA FormatNumber Function: The FormatNumber function in VBA is used to apply a number format to a numeric expression, and it returns the result as a string. Syntax FormatNumber (Expression, [NumDigitsAfterDecimal], [IncludeLeadingDigit], [UseParensForNegativeNumbers], [GroupDigits]) Parameter Expression (required)...

2 minutes read.

Excel VBA StrConv Function

The StrConv function in VBA converts a string into a specified format. Syntax StrConv (String, Conversion, [LocaleID]) Parameter String (required) – This parameter represents the string to be converted. Conversion (required) – This parameter specifies the type of conversion. It can...

1 minute read.

Excel VBA GoTo Statement

GoTo Statement he GoTo statement branches unconditionally to a specified line in a procedure. It is used to transfer the program control to a new statement, which is headed by a label. It sends...

2 minutes read.

Excel VBA IsArray Function

VBA IsArray Function: The IsArray function in VBA returns a Boolean, showing whether the given variable is an Array or not. Syntax IsArray (VarName) Parameter VarName (required)- This parameter represents the variable that you want...

1 minute read.

If ElseIf ElseIf Statement or Nested If statement in VBA

VBA Excel: If … ElseIf … ElseIf Statement or Nested If statement This function enables you to check multiple conditions and, based on that, then run one of the statement blocks present. If...

2 minutes read.

Excel VBA InputBox

Input Box The InputBox function in VBA is used to prompt the users to enter values. The user can click either the OK button or can choose the CANCEL button. If the user clicks...

3 minutes read.

Excel VBA WeekdayName Function

Excel VBA WeekdayName Function: The WeekdayName function in VBA returns a string containing the weekday name, for the specified integer representation of a weekday. Syntax WeekdayName (Weekday, [Abbreviate], [FirstDayOfWeek]) Parameter Weekday (required) – This parameter represents...

2 minutes read.

Excel VBA Trim Function

The Trim function in VBA removes the leading and trailing spaces from the specified string. Syntax Trim (String) Parameter String (required) – This parameter represents the string from which you want to remove the leading and...

1 minute read.

Excel VBA: Do Until….Loop

DO UNTIL….Loop The “Do Until” Loop is same unlike DO WHILE statement just that it will keep on looping till the condition is not met. This loop is used to repeat a set...

4 minutes read.

Excel VBA CBool Function

VBA CBool Function: The CBool function in VBA calculates an expression and returns the result as a Boolean data type. Syntax CBool (Expression) Parameter Expression (required) – This parameter represents the expression that that you want...

1 minute read.

ActiveX Controls

ActiveX Controls are one of the most used Excel Controls to automate applications with Excel VBA. It has the same controls, unlike Form Controls (Command Button, combo box, checkbox, etc.), but it...

3 minutes read.

VBA Dim

What is Dim? DIM or Dimension or Declare in Memory is a keyword that is used in VBA to declare a variable with the different data types (Integer, String, variable, Boolean, Double, etc.)...

7 minutes read.

Finding Last Row or Column in Excel VBA

Finding Last Row or Column in VBA Finding the last used row, column, or cell is one very commonly used task when we write macros and VBA applications.  Like other codes...

5 minutes read.

Excel VBA INT Function

VBA INT Function: The INT function in VBA rounds the given supplied number down and returns an integer value. The positive numbers are rounded to zero, and the negative numbers are rounded away from zero. Syntax Int...

1 minute read.

Excel VBA Minute Function

The Minute function in VBA returns the minute component for the specified time. Syntax Minute (Time) Parameter Time (required) – This parameter represents the time. Return This function returns the minute component for the specified time. Example 1 Sub MinteFunction_Example1() ...

1 minute read.

Excel VBA Round Function

VBA Round Function: The Round function in VBA rounds a number to a specified number of decimal places and returns the number. Syntax Round (Number, [NumDigitsAfterDecimal]) Parameter Number (required) –This parameter represents a numeric value one wants...

1 minute read.

Excel VBA Date Function

VBA Date Function The Date function in VBA returns the current date. Syntax Date( ) Parameter NA Return This function returns the current date. Example 1 Sub DateFunction_Example1() ' retuning the current date in the variable currentDate Dim currentDate As...

1 minute read.