×

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: DO WHILE….Loop

DO WHILE….Loop The “Do While” Loop is the same, unlike the FOR statement, just that it will keep on looping till the specified condition is true. It is used when we want to...

3 minutes read.

Excel VBA ABS Function

VBA ABS Function: The ABS function in VBA returns the absolute value of the specified number. Syntax Abs (Number) Parameter Number (required) – This parameter represents the number that you want the absolute value of. Return This...

1 minute read.

Excel VBA DatePart Function

The DatePart function in VBA returns a part (day, month, week, etc.) for the specified date and/or time. Syntax DatePart (Interval, Date, [FirstDayOfWeek], [FirstWeekOfYear]) Parameter Interval (required) – This parameter represents a string specifying the interval to be used. It can...

2 minutes read.

Excel VBA Len Function

VBA Len Function: The Len function in VBA returns the number of characters in a supplied string or the number of bytes required to store a supplied variable. Syntax Len (Expression) Parameter Expression (required)-...

1 minute read.

Excel VBA StrComp Function

VBA StrComp Function: The StrComp function in VBA compares two strings and returns an integer value displaying the result of the comparison. Syntax StrComp (String1, String2, [Compare]) Parameter String1 (required)- This parameter represents the first string to...

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 Mid Function

VBA Mid Function: The Mid function in VBA returns a substring from within a supplied string. Syntax Mid (Str, Start, [Length]) Parameter Str (required) -This parameter represents a string from which you want to extract the substring. Start...

1 minute read.

Excel VBA CVar Function

VBA CVar Function: The CVar function in VBA converts an expression into a Variant data type. Syntax CVar (Expression) Parameter Expression (required) – This parameter represents the expression that that you want to convert...

1 minute read.

Steps to Create a Pivot Table

Steps to Create a Pivot Table: Pivot Tables can be easily automated through VBA coding. To create a Pivot Table in VBA, follow the below step by step procedure to...

4 minutes read.

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...

3 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 CSng Function

VBA CSng Function: The CSng function in VBA converts the supplied expression into a single-precision floating-point number (single data type). Syntax CSng (Expression) Parameter Expression (required) – This parameter represents the expression that you want...

1 minute read.

Excel VBA While wend Loop

WHILE wend loop is used when the user is not sure how many times they want to execute the VBA code within the program. With a WHILE loop, the loop body may...

3 minutes read.

Excel VBA Chr Function

VBA Chr Function: The Chr function in VBA returns the character equivalent to a supplied character code between 0 and 255. Syntax Chr (CharCode) Parameter CharCode (required) – This parameter represents the character code for...

1 minute read.

Four VBA Clear methods

Four VBA Clear methods In Microsoft Excel, many times, a situation arises where the user wants to clear the data or any specific range of data. What if the user automates this task with...

6 minutes 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.

VBA Creating, Displaying, Uploading UserForms

UserForm is a customized interface and acts as a VBA container and can add various controls as per the required functionality, each of which has certain usage and related properties. You can...

4 minutes read.

Excel VBA TimeValue Function

Excel VBA TimeValue Function: The TimeValue function in VBA returns a Time from the specified String interpretation of a time /date where the date information for the given string is...

1 minute read.

VBA Charts Basic Operations

VBA Charts- Basic Operations The Chart Object in Excel VBA represents the collection of all the charts sheet present in a workbook. A chart can be either an embedded chart or a separate chart sheet. The...

6 minutes read.

Declaring a Variable in VBA

Declaring a Variable A variable is broadly described as a storage location combined with a name and representing a specific value. Declaring a variable is instructing the computer to reserve space...

2 minutes read.