Trending February 2024 # How To Insert Page Numbers In Excel Worksheets # Suggested March 2024 # Top 8 Popular

You are reading the article How To Insert Page Numbers In Excel Worksheets updated in February 2024 on the website Bellydancehcm.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested March 2024 How To Insert Page Numbers In Excel Worksheets

If your work involves printing your excel worksheets, it’s a good idea to insert page numbers in it.

Inserting page numbers in Excel takes a little more work as compared with other Microsoft applications such as Word or PowerPoint.

Watch Video – How to Insert Page Numbers in Excel

In this tutorial, you’ll learn how to insert page numbers in Excel worksheets.

How to Insert Page Numbers in Excel using the using the Page Layout View.

Insert Page Numbers in Excel Using the Page Setup Dialogue Box.

Start Page Numbering with the Desired Number.

Change the Order in which pages are numbered.

Remove Page Numbers from the Excel Worksheets.

If you want to insert page numbers in all the pages of a worksheet, using the page layout view is the fastest way to do it.

Here is how to do this:

This will insert a code

&[Page]

in the box.

Note that these page numbers are visible only in the Page Layout view. You would not see it when you go back to the normal view. If you print the worksheet, the page numbers also get printed.

Have a Different First Page Footer

You may want to have a different text in the footer on the first page, and regular page numbers of other pages. For example, on the first page, you may want to have Company’s name/website or copyright info along with the page number.

Here is how to do this:

While in the Page Layout view, select the footer box in the first page where you want to insert the text.

Enter the text that you want to display on the first page only. Let’s say, I want to show my website name in this case.

Now, whatever you have entered in the first page would only be visible on the first page and rest all the pages would show page numbers.

Have Different Odd and Even Pages Footer

If you want to have different page numbers for odd and even pages, you can easily do this using the inbuilt settings.

For example, you may not want to show page numbers on even pages.

Here is how to do this:

Go to View and select Page Layout view.

Scroll down and select the footer where you want to insert the page numbers in Excel.

You can also insert page numbers in Excel using the page setup dialogue box.

Here is how to do this:

This will open the Page Set dialogue box.

In the Page Setup dialogue box, select the Header/Footer tab.

In the Footer drop-down, select Page 1 of ? option. You will see the output format right below the drop-down.

This will instantly insert page numbers in Excel. If you want to insert page numbers in on the active worksheet only, follow the above steps. If you want to insert page numbers in multiple worksheets, select all the worksheets (hold the SHIFT key and select the worksheet tabs) and then follow the above steps.

If you are printing a report which is a continuation of some other report, or which is a part of some the overall report, you may want to begin page numbers with a different number (instead of 1).

To do this:

This will open the Page Set dialogue box.

In the Page Setup dialogue box, within the Page tab, change the First Page Number field from Auto to the number that you want to show/print.

If you have a large data set, by default, Excel would first insert page numbers to the all the sheets going down, and then move to the right and then number those sheets.

If you want to change the order, you can do this by following the below steps:

This will open the Page Set dialogue box.

In the Page Setup dialogue box, select the Sheet tab and change the page order from Down, then over to Over, the down.

To remove page numbers:

Go to View and select the Page Layout view.

Scroll down and select the footer where you see the page numbers.

You may also like the following Excel tutorials:

You're reading How To Insert Page Numbers In Excel Worksheets

How To Insert A Check Mark (Tick ✓) Symbol In Excel

Watch video – Insert and Use Checkmark Symbol in Excel

Below is the written tutorial, in case you prefer reading over watching the video.

In Excel, there are two kinds of tick marks (✓) that you can insert – a check mark and a checkbox.

And no… these are not the same.

Let me explain.

While a check mark and a checkbox may look somewhat similar, these two are very different in the way it can be inserted and used in Excel.

A check mark is a symbol that you can insert in a cell (just like any text that you type). This means that when you copy the cell, you also copy the check mark and when you delete the cell, you also delete the check mark. Just like regular text, you can format it by changing the color and font size.

A checkbox, on the other hand, is an object that sits above the worksheet. So when you place a checkbox above a cell, it’s not a part of the cell but is an object that is over it. This means that if you delete the cell, the checkbox may not get deleted. Also, you can select a checkbox and drag it anywhere in the worksheet (as it’s not bound to the cell).

You will find checkboxes being used in interactive reports and dashboards, while a checkmark is a symbol that you may want to include as a part of the report.

A check mark is a symbol in the cell and a checkbox (which is literally in a box) is an object that is placed above the cells.

In this article, I will only be covering check marks. If you want to learn more about checkbox, here is a detailed tutorial.

There are quite a few ways that you can use to insert a check mark symbol in Excel.

In this article, I will show you all the methods I know.

The method you use would be dependent on how you want to use the check mark in your work (as you’ll see later in this tutorial).

Let’s get started!

Starting with the easiest one.

Since you’re already reading this article, you can copy the below check mark and paste it in Excel.

Simply paste the check mark (Control + V).

Once you have the check mark in Excel, you can copy it and paste it as many times as you want.

This method is suited when you want to copy paste the check mark in a few places. Since this involves doing it manually, it’s not meant for huge reports where you have to insert check marks for hundreds or thousands of cells based on criteria. In such a case, it’s better to use a formula (as shown later in this tutorial).

For using the keyboard shortcuts, you will have to change the font of the cells to Wingdings 2 (or Wingdings based on the keyboard shortcut you’re using).

Below are the shortcuts for inserting a check mark or a cross symbol in cells. To use the below shortcuts, you need to change the font to Wingdings 2.

Below are some more keyboard shortcuts that you can use to insert check mark and cross symbols. To use the below shortcuts, you need to change the font to Wingdings (without the 2).

This method is best suited when you only want a check mark in the cell. Since this method requires you to change the font to Wingdings or Wingdings 2, it will not be useful if you want to have any other text or numbers in the same cell with the check mark or the cross mark.

Another way to insert a check mark symbol (or any symbol for that matter) in Excel is using the Symbol dialog box.

Here are the steps to insert the check mark (tick mark) using the Symbol dialog box:

Select the cell in which you want the check mark symbol.

In the Symbol dialog box that opens, select ‘Segoe UI Symbol’ as the font.

The above steps would insert one check mark in the selected cell.

If you want more, simply copy the already inserted one and use it.

Note that using ‘Segoe UI Symbol’ allows you to use the check mark in any regularly used font in Excel (such as Arial, Time Now, Calibri, or Verdana). The shape and size may adjust a little based on the font. This also means that you can have text/number along with the check mark in the same cell.

This method is a bit longer but doesn’t require you to know any shortcut or CHAR code. Once you have used it to insert the symbol, you can reuse that one by copy pasting it.

You can use the CHAR function to return a check mark (or a cross mark).

The below formula would return a check mark symbol in the cell.

=CHAR(252)

For this to work, you need to convert the font to Wingdings

Why?

Because when you use the CHAR(252) formula, it would give you the ANSI character (ü), and then when you change the font to Wingdings, it is converted to a check mark.

You can use similar CHAR formulas (with different code number) to get another format of the check mark or the cross mark.

The real benefit of using a formula is when you use it with other formulas and return the check mark or the cross mark as the result.

For example, suppose you have a dataset as shown below:

You can use the below IF formula to get a check mark if the sale value is more than 5000 and a cross mark if it’s less than 5000.

Remember, you need to convert the column font to Wingdings.

This helps you make your reports a little more visual. It also works well with printed reports.

This method is suited when you want the check mark insertion to be dependent on cell values. Since this uses a formula, you can use it even when you have hundreds or thousands of cells. Also, since you need to change the font of the cells to Wingdings, you can’t have anything else in the cells except the symbols.

Excel has a feature where it can autocorrect misspelled words automatically.

For example, type the word ‘bcak’ in a cell in Excel and see what happens. It will automatically correct it to the word ‘back’.

This happens as there is already a pre-made list of expected misspelled words you’re likely to type and Excel automatically corrects it for you.

Here are the steps to use autocorrect to insert the delta symbol:

In the Options dialogue box, select Proofing.

In the Autocorrect dialogue box, enter the following:

Replace: CMARK

With: ✔ (you can copy and paste this)

Now whenever you type the words CMARK in a cell in Excel, it will automatically change it to a check mark.

Here are a few things you need to know when using the Autocorrect method:

This is case sensitive. So if you enter ‘cmark’, it will not get converted into the check mark symbol. You need to enter CMARK.

This change also gets applied to all the other Microsoft applications (MS Word, PowerPoint, etc.). So be cautious and choose the keyword that you are highly unlikely to use in any other application.

If there is any text/number before/after CMARK, it will not be converted to the check mark symbol. For example, ‘38%CMARK’ will not get converted, however, ‘38% CMARK’ will get converted to ‘38% ✔’

Related Tutorial: Excel Autocorrect

This method is suited when you want a ready reference for the check mark and you use it regularly in your work. So instead of remembering the shortcuts or using the symbols dialog box, you can quickly use the shortcode name that you have created for check mark (or any other symbol for that matter).

You can use conditional formatting to insert a check mark or a cross mark based on the cell value.

For example, suppose you have the data set as shown below and you want to insert a check mark if the value is more than 5000 and a cross mark if it’s less than 5000.

Here are the steps to do this using conditional formatting:

In cell B2, enter =A2, and then copy this formula for all cells. This will make sure that now you have the same value in the adjacent cell and if you change the value in column A, it’s automatically changed in column B.

Select all the cells in column B (in which you want to insert the check mark).

In the ‘Icon Style’ drop-down, select the style with the check mark and cross mark.

Check the ‘Show Icon only’ box. This will ensure that only the icons are visible and the numbers are hidden.

In the Icon settings. change the ‘percent’ to the ‘number’ and make the settings as shown below.

The above steps will insert a green check mark whenever the value is more than or equal to 5000 and a red cross mark whenever the value is less than 5000.

In this case, I have only used these two icons, but you can also use the yellow exclamation mark as well if you want.

Sub InsertCheckMark() Range("A1").Font.Name = "Wingdings" Range("A1").Value = "ü" End Sub

Below is the code to do this:

If Target.Column = 2 Then Cancel = True Target.Font.Name = “Wingdings” If Target.Value = “” Then Target.Value = “ü” Else Target.Value = “” End If End If End Sub

A check mark is just like any other text or symbol that you use.

This means that you can easily change its color and size.

All you need to do is select the cells that have the symbol and apply the formatting such as font size, font color, and bold etc.

This way of formatting symbols is manual and suited only when you have a couple of symbols to format. If you have a lot of these, it’s better to use conditional formatting to format these (as shown in the next section).

With conditional formatting, you can format the cells based on what type of symbol it has.

Below is an example:

Column B uses the CHAR function to return a check mark if the value is more than 5000 and a cross mark if the value is less than 5000.

The ones in column C and D uses conditional formatting and look way better as it improves visual representation using colors.

Let’s see how you can do this.

Below is a dataset where I have used the CHAR function to get the check mark or cross mark based on the cell value.

Below are the steps to color the cells based on the symbol it has:

Select the cells that have the check-mark/cross-mark symbols.

In the New Formatting Rule dialog box, select ‘Use a formula to determine which cells to format’

In the formula field, enter the following formula: =B2=CHAR(252)

In the ‘Format Cells’ dialog box, go to the Fill tab and select the green color.

Go to the Font tab and select color as white (this is to make sure your checkmark looks nice when the cell has a green background color).

After the above steps, the data is going to look as shown below. All the cells that have the check mark will be colored in green with white font.

You need to repeat the same steps to now format the cells with a cross mark. Change the formula to =B2=char(251) in step 6 and formatting in step 9.

If you want to count the total number of check marks (or cross marks), you can do that using a combination of COUNTIF and CHAR.

For example, suppose you have the data set as shown below and you want to find out the total number of stores that have achieved the sales target.

Below is the formula that will give you the total number of check marks in column C

=COUNTIF($C$2:$C$10,CHAR(252))

Note that this formula relies on you using the ANSI code 252 to get the check mark. This would work if you have used the keyboard shortcut ALT 0252, or have used the formula =Char(252) or have copied and pasted the check mark that is the created using these methods. If this is not the case, then the above COUNTIF function is not going to work.

You May Also like the following Excel tutorials:

How Insert Done In T

Introduction to T-SQL INSERT

T-SQL is a Transact SQL. It is an extension of the SQL language. Similar to SQL, we have data types, functions, indexes, and procedure concepts in the T-SQL. It is a Microsoft product. SQL stands for structured query language. SQL (structured query language) is common for all RDBMS.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Structured query language (SQL) stands as an intermediate interaction to the databases. We use commands by which we get data from the database. It has INSERT, SELECT, DELETE, DROP, TRUNCATE, and many other commands related to the actions to be done with the data.

Syntax:

Let us consider the Insert command syntax in T-SQL; – As T-SQL insert is an extension of SQL language, the syntax is similar to SQL.

There are two ways we can determine they are stated below:

1.

INSERT INTO TABLE_NAME [(column_name1, column_name2, column_name3,...column_nameN)] VALUES (col1_value, col2_value, col3_value,...colN_value);

Above, we determine the column list as well. If we don’t specify the column and insert it takes the value to ‘NULL’

2.

INSERT INTO TABLE_NAME VALUES (col1_value, col2_value, col3_value,...colN_value);

Above syntax, all the column data should match, not an error will be thrown.

How Insert done in T-SQL?

Now let us consider the above two syntaxes and try to insert them into the table.

INSERT INTO TABLE_NAME [(column_name1, column_name2, column_name3,...column_nameN)] VALUES (col1_value, col2_value, col3_value,...colN_value);

Let us create a table and use the above syntax format and insert data into the table: –

create table Test_insert_command ( shop_id int, product_id int, brand_id int, Shop_name varchar(20), quantity int, price int );

Now let us insert data into the table:

insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name,quantity,price) values (1,1,1,'Kellogs',45,45); insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name,quantity,price) values (2,7,5,'Fantasy Store',75,145); insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name,quantity,price) values (3,3,2,'Laxshmi store',65,85); insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name,quantity,price) values (4,4,7,'General store',25,65); insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name,quantity,price) values (5,5,8,'Corn store',35,75); select * from Test_insert_command;

In the above insert statement’s we have given all the values and inserted them into the table. The result will be as below:

insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name) values (6,1,1,'Kels Store'); insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name) values (4,7,5,'Paradise Store'); insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name) values (6,3,2,'Luxury store'); insert into Test_insert_command(shop_id,product_id,brand_id,Shop_name) values (1,4,7,'General store'); select * from test_insert_command;

Output:

As no data is inserted in the column quantity, price the values are inserted as NULL.

Now let us change the order and insert the data.

insert into Test_insert_command(shop_id,brand_id,Shop_name,product_id) values (6,1,'Kels Store',9); insert into Test_insert_command(shop_id,product_id,brand_id, quantity) values (4,7,5,340); insert into Test_insert_command(shop_id,product_id,brand_id, price) values (6,3,2,12); select * from test_insert_command;

Output:

Now let us insert in the below format:

Syntax:

INSERT INTO TABLE_NAME VALUES (col1_value, col2_value, col3_value,...colN_value); insert into test_insert_command values(3, 7, 5,'Posaman store', 67, 900); insert into test_insert_command values(9, 3, 7,'man store', 17, 670); insert into test_insert_command values(4, 10, 2,'saman store', 77, 560); select * from test_insert_command;

Output:

Example

Now let us see another example for the insert command:

create table test_insert ( stud_id int, stud_mark int, stud_subject varchar(10) );

1. Insert data into the table:

insert into test_insert(stud_id,stud_mark,stud_subject)values (1, 89,'English'); insert into test_insert(stud_id,stud_subject,stud_mark)values (6,'English', 78); insert into test_insert(stud_subject,stud_id,stud_mark)values ('English', 4, 89); insert into test_insert values (8, 69,'English'); insert into test_insert values (9, 49,'English'); insert into test_insert values (5, 79,'English');

Let us insert few more rows and perform Select statement for the above table:

insert into test_insert(stud_id,stud_subject)values (16,'English'); insert into test_insert(stud_subject,stud_id)values ('English', 67); select * from test_insert;

Output:

Conclusion

Similar to SQL, we have data types, functions, index, and procedure concepts in the T-SQL. It is a Microsoft product. SQL stands for structured query language. SQL (structured query language) is common for all RDBMS.

Recommended Articles

We hope that this EDUCBA information on “T-SQL INSERT” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

How To Insert Emoji In Instagram? – Webnots

Instagram is the most popular social media platform for mobile users. You can instantly share pictures and short videos to your followers and follow their activities to keep you busy. Inserting emoji in your Instagram activities will be more fun as well as speed up your posting instead of typing lengthy text. In this article, we will explain the possible ways of inserting emoji in Instagram.

Instagram is a Mobile App

As you may aware, Instagram offers mobile apps for Android and iOS platforms. You can login to your Instagram account through a browser on both mobile and desktop devices. However, Instagram does not allow you to post from desktop and you only need to publish content using the mobile apps. Due to this restriction, we will explain how to insert emoji in Instagram using Android and iPhone devices. You can also post from Instagram website with emoji caption similarly as explained below.

Emoji Keyboard on Android and iOS

Instagram uses the in-built emoji keyboard on your smartphone. Apple offers an in-built emoji keyboard that you can add to your keyboard layout. However, on Android devices, you may need to use Gboard extension from Google or any other keyboard extensions that offer emoji. Since the Instagram mobile app interface is same in Android and iPhone, you can follow the same instructions on both Android, iPhone and iPad.

Related: How to delete Instagram account permanently or disable temporarily?

Inserting Emoji in Instagram

There are multiple places you can insert emoji in Instagram:

Let us explain all these options in detail.

Inserting Emoji in Instagram Posts

Follow the below instructions to insert emoji in Instagram posts:

Create Post in Instagram

After selecting a picture or video, tap on the place where it shows “Write a caption”.

Write a Caption

This will open the default keyboard on your phone and tap on the emoji icon that is available next to the space key.

Open Keyboard for Typing

Alternatively, tap on the globe icon and choose “Emoji” as your keyboard option.

Change Keyboard Layout

Now, you will see all available emoji as a list. Tap on your favorite emoji to insert as a caption for your Instagram post.

Insert Emoji in Instagram

If you can’t find the emoji from the list, type the emoji name in the search box to filter relevant symbols. For example, type “think” to find the thinking face emoji symbol easily.

Search Emoji

You can insert multiple emoji symbols in the caption text box.

Tap on “OK” and then “Share” to share the post with emoji to your followers.

Inserting Emoji in Instagram Profile

You can insert emoji in your profile bio section with short text to make it appealing.

Tap on profile icon on the bottom right corner.

Go to Profile

When you are on your profile page, tap on “Edit Profile” button.

Edit Instagram Profile

Tap on “Bio” section and insert the emoji as explained above from emoji keyboard on your phone.

Emoji in Bio Section

The bio will show below your name in the app that will be appealing to your followers when using proper emoji.

You can anytime change the emoji to update your bio section.

Insert Emoji Stickers in Story

Instagram only allows you to insert emoji stickers when creating a story.

Emoji Stickers in Instagram Stories

Top Emoji Symbols for Instagram

Emoji keyboard on your phone will show you the list of recently or frequently used emoji symbols. You can choose from this list instead of searching or checking in the big list. In addition, emoji in the list are grouped and categorized which you can access easily by tapping on the category showing at the bottom of the emoji list.

Here are the available emoji categories for you in the emoji keyboard:

Smileys & people

Animals & nature

Food & drink

Activity

Travel & places

Objects

Symbols

Flags

For example, you can tap on “Flags” category when you want to quickly insert a flag emoji of any country. Use the backspace button to delete you emoji or tap on ABC to switch the keyboard to default layout.

Comment in WordsEmoji CommentGo to hell😈🔥⬅️Between rock and a hard space🪨😔🪨Read it and weep👀📕😭That was cold🥶❄️Your are in a doghouse🐶🏠No time for your B.S.🚫⏰🐂💩Screw you🪛😬Get out of here🚪🏃Not my cup of tea☕️🙅Going for lunch / dinner🍽🚶You are in deep shit🏊💩

Note: You can search photos using emoji hashtag in Instagram. For example, you can explore all posts with the pizza hashtag.

How To Use Boolean In Excel Vba With Excel Template?

VBA Boolean Operation

In Excel when we compare two cell contents or numbers by applying equal sign between them, we get output in TRUE or FALSE format. Which means values which we are comparing may be equal or may not be equal. In a similar manner, we have Boolean in VBA Excel. Boolean also gives the output in the form of TRUE or FALSE. Boolean is a form of data type which can only contain either TRUE or FALSE. When we give some input to Boolean and if the test becomes TRUE then we get an answer as TRUE or we get FALSE.

How to Use Boolean in VBA Excel?

Let’s see the examples of Boolean in Excel VBA.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

You can download this VBA Boolean Excel Template here – VBA Boolean Excel Template

Example #1 – VBA Boolean

Let’s see a very simple example where we will see how to apply Boolean while comparing some.

Step 2: Now in the opened module, write the sub category of VBA Boolean. We can choose to write any name of subprocedure here.

Code:

Sub

VBABoolean1()

End Sub

Step 3: Now define a Dim with any name, let’ say an A and assign the variable A as Boolean as shown below.

Sub

VBABoolean1()

Dim

A

As Boolean

End Sub

Step 4: Let’s consider two numbers, 1 and 2. And now we will test with the help of Boolean whether 2 is greater than 1 or not. So in the next line, write a mathematical expression of 1<2 under defined variable A.

Code:

Sub

VBABoolean1()

Dim

A

As Boolean

A = 1 < 2

End Sub

Step 5: Now assign a message box to variable A to see what outcome will appear when we run the code.

Code:

Sub

VBABoolean1()

Dim

A

As Boolean

A = 1 < 2 MsgBox A

End Sub

Step 7: If we change the sign as 1 is greater than 2 as shown below. What would we get?

Code:

Sub

VBABoolean1()

Dim

A

As Boolean

MsgBox A

End Sub

Step 8: To test this, again run the code. We will see, Boolean has given FALSE as 1 cannot be greater than 2.

Example #2 – VBA Boolean

In this example, we will test if Boolean works for text or not. To apply this, we need a module.

Step 1: Open a new Module and give it a subcategory in the name of VBA Boolean or any name as per your choice.

Sub

VBABoolean2()

End Sub

Step 2: Define a variable A and assign a Boolean function to it.

Code:

Sub

VBABoolean2()

Dim

A

As Boolean

End Sub

Step 3: Now assign a text to defined variable A. Let’s say that text is VBA Boolean. And it should be under inverted commas.

Code:

Sub

VBABoolean2()

Dim

A

As Boolean

A = "VBA  Boolean"

End Sub

Step 4: At last, give that variable A in a message box to see the output as shown below.

Code:

Sub

VBABoolean2()

Dim

A

As Boolean

A = "VBA Boolean" MsgBox A

End Sub

Step 5: Once done, run the code. We will get an error message as “Run-time error 12 – Type Mismatch” which means that Boolean doesn’t support input as Text.

Example #3 – VBA Boolean

In this example, we will see, if Boolean works for a number without any comparison.

Step 1: Open a new module and give it a subcategory of VBA Boolean as shown below.

Code:

Sub

VBABoolean3()

End Sub

Step 2: Now define a Dim A variable as Boolean as shown below.

Code:

Sub

VBABoolean3()

Dim

A

As Boolean

End Sub

Step 3: As discussed above, we will give the variable A a number. Let’s consider that number is 10.

Code:

Sub

VBABoolean3()

Dim

A

As Boolean

A = 10

End Sub

Step 4: After that, select the function msgbox and assign it to variable A. This will help us print the value with the help of Boolean.

Code:

Sub

VBABoolean3()

Dim

A

As Boolean

A = 10 MsgBox A

End Sub

Step 5: Now run the code. We will get the message with the message as TRUE.

Step 6: Now let’s change that value to 0 from 10.

Code:

Sub

VBABoolean3()

Dim

A

As Boolean

A = 0 MsgBox A

End Sub

Example #4 – VBA Boolean

Step 1: Now, open a new module and write the subcategory of VBA Boolean as shown below.

Code:

Sub

VBABoolean4()

End Sub

Step 2: Now define 2 variable with any name as per your choice. Here, we have selected A and B as Integer. Which means both will store numeric values.

Code:

Sub

VBABoolean4()

Dim

A

As Integer

Dim

B

As Integer

End Sub

Step 3: Now assign any values to variable A and B. Here we have chosen number 1 and 2 for variable A and B as shown below.

Code:

Sub

VBABoolean4()

Dim

A

As Integer

Dim

B

As Integer

A = 1 B = 2

End Sub

Step 4: As stated above, we will use the If-Else loop. Now open the If-End If loop where we will write the criteria.

Code:

Sub

VBABoolean4()

Dim

A

As Integer

Dim

B

As Integer

A = 1 B = 2 If

End If

End Sub

Step 5: Now write the code, If A is less than equal to B then show us the message as TRUE, else show us the message as FALSE.

Code:

Sub

VBABoolean4()

Dim

A

As Integer

Dim

B

As Integer

A = 1 B = 2

If

A <= B

Then

MsgBox

True

Else

MsgBox

False

End If

End Sub

Step 6: Now compile the above code step-by-step and then run if no error found. We will see, the message box has the message as TRUE which means value stored in variable A (which is 1) is less than the value stored in variable B (which is 2).

Pros of VBA Boolean

It is quite useful when we are want to implement the process flow following TRUE and FALSE for each iteration.

Conditional comparison with the help of any kind of loop can easily be implemented.

Cons of VBA Boolean

Only numbers can be used in Boolean. It will show the error if used for text as seen in example-2.

Things to Remember

Using Boolean with any loop will give users a better output. And comparison can be done in various ways.

Boolean is a kind of cell comparison formula used in excel, but it only compares the numerical or mathematical values.

Always save the file in macro enable format to retain the written code to be used in the future.

Recommended Articles

This is a guide to VBA Boolean. Here we discuss how to use Boolean in Excel VBA along with practical examples and downloadable excel template. You can also go through our other suggested articles –

How To Create Arraylist In Excel Vba With Excel Template?

Excel VBA ArrayList

Data structures are used to store a series of data in programming languages. It binds to the memory rather than address. An ArrayList is one of the data structures in excel. Comparing to normal arrays in excel ArrayList is dynamic. Therefore, no initial declaration of size is needed. ArrayList is not a part of VBA it is associated with an external library which can be used with VBA.

ArrayList can be defined as a list of a nearby memory location. Where the values are retrieved using the index numbers. The list starts from an index number ‘0’, the first element will be inserted into the ‘0’ index and rest is followed by 1, 2, 3, etc. ArrayList offers plenty of built-in operations, sorting, adding, removing, reversing, etc. are some among them.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Adding the Library

To use the ArrayList into the VBA it needs to include the library ‘mscorlib.dll’ which comes with .NET framework.

It will lead you to a window with a list of different libraries which supports in VBA and Excel. Scroll down to find the ‘dll’. Tick mark to confirm the selection then press ‘OK’ button.

Now the library is included in your VBA code and it will support different methods associated with an ArrayList.

How to Create VBA ArrayList in Excel?

You can download this VBA ArrayList Excel Template here – VBA ArrayList Excel Template

Excel VBA ArrayList – Example #1

How to Add Values to the ArrayList using VBA?

ArrayList act as a list where we can add values. This will automatically store in the different portions starting from 0,1, 2, etc. The values can add or insert to the ArrayList using the add method.

In this example, you will learn how to add a list of values into an ArrayList. Follow the below steps to add ArrayList using VBA Code in excel.

Step 1: To add a list of values to an ArrayList create a function arraylist1.

Code:

Private Sub

arraylist1()

End Sub

Step 2: Now we want to include the ArrayList into the function as an object where a list is declared as an ArrayList.

Code:

Private Sub

arraylist1()

Dim

alist

As ArrayList

End Sub

Step 3: Since this is an object to use it, you have to create an instance of the ArrayList. Set a new instance for this object.

Code:

Private Sub

arraylist1()

Dim

alist

As ArrayList

Set

alist =

New

ArrayList

End Sub

Step 4: Now using the ‘Add’ property of an ArrayList adds the values to the ArrayList. Where the list is added into the index values in an order 0,1,2,3 etc.

Code:

Private Sub

arraylist1()

Dim

alist

As ArrayList

Set

alist =

New

ArrayList alist.Add "192"

'index(0)

alist.Add "168"

'index(1)

alist.Add "1"

'index(2)

alist.Add "240"

'index(3)

End Sub

Step 5: To check whether the values got added into the list, let’s print the array values using a message box. To print the values each index is printed since the values are stored in these partitions.

Code:

Private Sub

arraylist1()

Dim

alist

As ArrayList

Set

alist =

New

ArrayList alist.Add "192"

'index(0)

alist.Add "168"

'index(1)

alist.Add "1"

'index(2)

alist.Add "240"

'index(3)

MsgBox ("\" & alist(0) & "." & alist(1) & "." & alist(2) & "." & alist(3))

End Sub

Step 6: Press F5 or run button to run the program and the values will be printed as below. Here an IP address is stored in the ArrayList and while printing the values extra notations are concatenated to form the IP address in a proper format.

Automation error in VBA

It is a common error happens while running an ArrayList. An automation error may encounter ‘Run-time Error ‘-2146232576 (80131700) Automation Error’

Excel VBA ArrayList – Example #2

Sorting ArrayList Using VBA Code 

ArrayList supports different functions like sorting, reversing, etc. this help to sort the values inserted into an ArrayList. Once you add a list into the ArrayList it is possible to reverse the inserted list.

Follow the below steps to sort the ArrayList using VBA Code:

Step 1: Create a function called arraysort1 to perform the sorting within the inserted values into an ArrayList.

Code:

Sub

arraysort1()

End Sub

Step 2: Declare an object ‘arraysort’ of the ArrayList. Use this object to add and sort the values within the ArrayList.

Code:

Sub

arraysort1()

Dim

arraysort

As ArrayList

End Sub

Step 3: Similar to the first example need to create a new instance of the declared object. Set this instance as a new ArrayList.

Code:

Sub

arraysort1()

Dim

arraysort

As ArrayList

Set

arraysort =

New

ArrayList

End Sub

Step 4: Now using the ‘Add’ method insert the elements to the ArrayList. Which is not possessing any order on values. Randomly inserted some values into the list.

Code:

Sub

arraysort1()

Dim

arraysort

As ArrayList

Set

arraysort =

New

ArrayList arraysort.Add "13" arraysort.Add "21" arraysort.Add "67" arraysort.Add "10" arraysort.Add "12" arraysort.Add "45"

End Sub

Code:

Sub

arraysort1()

Dim

arraysort

As ArrayList

Set

arraysort =

New

ArrayList arraysort.Add "13" arraysort.Add "21" arraysort.Add "67" arraysort.Add "10" arraysort.Add "12" arraysort.Add "45" MsgBox (arraysort(0) & vbCrLf & arraysort(1) _ & vbCrLf & arraysort(2) & vbCrLf & arraysort(3) _ & vbCrLf & arraysort(4) & vbCrLf & arraysort(5))

End Sub

Step 6: Press F5 on the keyboard or run button on the code window to run the program to print the ArrayList. The ArrayList is printed in the same order as it is inserted since we use the index numbers in its correct order.

Step 7: Now to this list apply the sort property of the ArrayList. Use the sort method to sort the inserted list. The sort property will sort the list of values in ascending order by default.

Code:

Sub

arraysort1()

Dim

arraysort

As ArrayList

Set

arraysort =

New

ArrayList arraysort.Add "13" arraysort.Add "21" arraysort.Add "67" arraysort.Add "10" arraysort.Add "12" arraysort.Add "45" arraysort.Sort MsgBox (arraysort(0) & vbCrLf & arraysort(1) _ & vbCrLf & arraysort(2) & vbCrLf & arraysort(3) _ & vbCrLf & arraysort(4) & vbCrLf & arraysort(5))

End Sub

Step 8: Hit F5 or Run button under VBE to run this code, Where the values are sorted and printed in order from smallest value to largest.

Excel VBA ArrayList – Example #3

Reversing the ArrayList using VBA Code

When you want to reverse the order of inserted values in an ArrayList reverse method is available. This will reverse the order of the list from its current order. Now we have already sorted the ArrayList in the previous example, which is in ascending order.

Let’s try to reverse the sorted array to make it descending order. Use the reverse method of ArrayList to do this.

Code:

Sub

arraysort2()

Dim

arraysort

As ArrayList

Set

arraysort =

New

ArrayList arraysort.Add "13" arraysort.Add "21" arraysort.Add "67" arraysort.Add "10" arraysort.Add "12" arraysort.Add "45" arraysort.Sort arraysort.Reverse MsgBox (arraysort(0) & vbCrLf & arraysort(1) _ & vbCrLf & arraysort(2) & vbCrLf & arraysort(3) _ & vbCrLf & arraysort(4) & vbCrLf & arraysort(5))

End Sub

After applying the reverse method, the ArrayList will become in descending order and use the message box to print the reversed array. The sorted list is changed from large value to small value.

Things to Remember

ArrayList is dynamic in nature; it does not require re-initialization.

Different built-in methods are associated with ArrayList.

Compared to the array, ArrayList is easy to use in Excel VBA.

The supporting .NET libraries should be included in the VBA to work with ArrayList.

ArrayList is a continuing memory location which identified using index values.

Recommended Articles

This is a guide to VBA ArrayList. Here we discuss how to create ArrayList in Excel VBA along with practical examples and downloadable excel template. You can also go through our other suggested articles –

Update the detailed information about How To Insert Page Numbers In Excel Worksheets on the Bellydancehcm.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!