Trending March 2024 # Excel Vba Msgbox – All You Need To Know! # Suggested April 2024 # Top 5 Popular

You are reading the article Excel Vba Msgbox – All You Need To Know! updated in March 2024 on the website 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 April 2024 Excel Vba Msgbox – All You Need To Know!

In Excel VBA, you can use the MsgBox function to display a message box (as shown below):

A MsgBox is nothing but a dialog box that you can use to inform your users by showing a custom message or get some basic inputs (such as Yes/No or OK/Cancel).

Note: In this tutorial, I will be using the words message box and MsgBox interchangeably. When working with Excel VBA, you always need to use MsgBox.

A message box has the following parts:

Title: This is typically used to display what the message box is about. If you don’t specify anything, it displays the application name – which is Microsoft Excel in this case.

Prompt: This is the message that you want to display. You can use this space to write a couple of lines or even display tables/data here.

Button(s): While OK is the default button, you can customize it to show buttons such as Yes/No, Yes/No/Cancel, Retry/Ignore, etc.

As I mentioned, MsgBox is a function and has a syntax similar to other VBA functions.

MsgBox( prompt [, buttons ] [, title ] [, helpfile, context ] )

prompt – This is a required argument. It displays the message that you see in the MsgBox. In our example, the text “This is a sample MsgBox” is the ‘prompt’. You can use up to 1024 characters in the prompt, and can also use it to display the values of variables. In case you want to show a prompt that has multiple lines, you can do that as well (more on this later in this tutorial).

[buttons] – It determines what buttons and icons are displayed in the MsgBox. For example, if I use vbOkOnly, it will show only the OK button, and if I use vbOKCancel, it will show both the OK and Cancel buttons. I will cover different kinds of buttons later in this tutorial.

[title] – Here you can specify what caption you want in the message dialog box. This is displayed in the title bar of the MsgBox. If you don’t specify anything, it will show the name of the application.

[context] – It is a numeric expression that is the Help context number assigned to the appropriate Help topic.

If you’re new to the concept of Msgbox, feel free to ignore the [helpfile] and [context] arguments. I have rarely seen these being used.

Note: All the arguments in square brackets are optional. Only the ‘prompt’ argument is mandatory.

In this section, I will cover the different types of buttons that you can use with a VBA MsgBox.

Before I show you the VBA code for it and how the MsgBox looks, here is a table that lists all the different button constants you can use.

Button Constant Description

vbOKOnly Shows only the OK button

vbOKCancel Shows the OK and Cancel buttons

vbAbortRetryIgnore Shows the Abort, Retry, and Ignore buttons

vbYesNo Shows the Yes and No buttons

vbYesNoCancel Shows the Yes, No, and Cancel buttons

vbRetryCancel Shows the Retry and Cancel buttons

vbMsgBoxHelpButton Shows the Help button. For this to work, you need to use the help and context arguments in the MsgBox function

vbDefaultButton1 Makes the first button default. You can change the number to change the default button. For example, vbDefaultButton2 makes the second button as the default

Note: While going through the examples of creating different buttons, you may wonder what’s the point of having these buttons if it doesn’t have any impact on the code.

Now let’s have a look at some examples of how the different buttons can be displayed in a MsgBox and how it looks.

MsgBox Buttons – vbOKOnly (Default)

If you only use the prompt and don’t specify any of the arguments, you will get the default message box as shown below:

Below is the code that will give this message box:

Sub DefaultMsgBox() MsgBox "This is a sample box" End Sub

Note that the text string needs to be in double quotes.

You can also use the button constant vbOKOnly, but even if you don’t specify anything, it’s taken as default.

MsgBox Buttons – OK & Cancel

If you only want to show the OK and the Cancel button, you need to use the vbOKCancel constant.

Sub MsgBoxOKCancel() MsgBox "Want to Continue?", vbOKCancel End Sub

MsgBox Buttons – Abort, Retry, and Ignore

You can use the ‘vbAbortRetryIgnore’ constant to show the Abort, Retry, and the Ignore buttons.

Sub MsgBoxAbortRetryIgnore() MsgBox "What do you want to do?", vbAbortRetryIgnore End Sub

MsgBox Buttons – Yes and No

You can use the ‘vbYesNo’ constant to show the Yes and No buttons.

Sub MsgBoxYesNo() MsgBox "Should we stop?", vbYesNo End Sub

MsgBox Buttons – Yes, No and Cancel

You can use the ‘vbYesNoCancel’ constant to show the Yes, No, and Cancel buttons.

Sub MsgBoxYesNoCancel() MsgBox "Should we stop?", vbYesNoCancel End Sub

MsgBox Buttons – Retry and Cancel

You can use the ‘vbRetryCancel’ constant to show the Retry and Cancel buttons.

Sub MsgBoxRetryCancel() MsgBox "What do you want to do next?", vbRetryCancel End Sub

MsgBox Buttons – Help Button

You can use the ‘vbMsgBoxHelpButton’ constant to show the help button. You can use it with other button constants.

Sub MsgBoxRetryHelp() MsgBox "What do you want to do next?", vbRetryCancel + vbMsgBoxHelpButton End Sub

Note that in this code, we have combined two different button constants (vbRetryCancel + vbMsgBoxHelpButton). The first part shows the Retry and Cancel buttons and the second part shows the Help button.

MsgBox Buttons – Setting a Default Button

You can use the ‘vbDefaultButton1’ constant to set the first button as default. This means that the button is already selected and if you press enter, it executes that button.

Below is the code that will set the second button (the ‘No’ button) as the default.

Sub MsgBoxOKCancel() MsgBox "What do you want to do next?", vbYesNoCancel + vbDefaultButton2 End Sub

In most cases, the left-most button is the default button. You can choose other buttons using vbDefaultButton2, vbDefaultButton3, and vbDefaultButton4.

Apart from the buttons, you can also customize the icons that are displayed in the MsgBox dialog box. For example, you can have a red critical icon or a blue information icon.

Below is a table that lists the code that will show the corresponding icon.

Icon Constant Description

vbCritical Shows the critical message icon

vbQuestion Shows the question icon

vbExclamation Shows the warning message icon

vbInformation Shows the information icon

MsgBox Icons – Critical

If you want to show a critical icon in your MsgBox, use the vbCritical constant. You can use this along with other button constants (by putting a + sign in between the codes).

For example, below is a code that will show the default OK button with a critical icon.

Sub MsgBoxCriticalIcon() MsgBox "This is a sample box", vbCritical End Sub

If you want to show the critical icon with Yes and No buttons, use the following code:

Sub MsgBoxCriticalIcon() MsgBox "This is a sample box", vbYesNo + vbCritical End Sub

MsgBox Icons – Question

If you want to show a critical icon in your MsgBox, use the vbQuestion constant.

Sub MsgBoxQuestionIcon() MsgBox "This is a sample box", vbYesNo + vbQuestion End Sub

MsgBox Icons – Exclamation

If you want to show an exclamation icon in your MsgBox, use the vbExclamation constant.

Sub MsgBoxExclamationIcon() MsgBox "This is a sample box", vbYesNo + vbExclamation End Sub

MsgBox Icons – Information

If you want to show an information icon in your MsgBox, use the vbInformation constant.

Sub MsgBoxInformationIcon() MsgBox "This is a sample box", vbYesNo + vbInformation End Sub

When using MsgBox, you can customize the title and the prompt messages.

So far, the example we have seen have used Microsoft Excel as the title. In case you don’t specify the title argument, MsgBox automatically uses the title of the application (which has been Microsoft Excel in this case).

You can customize the title by specifying it in the code as shown below:

Sub MsgBoxInformationIcon() MsgBox "Do you want to continue?", vbYesNo + vbQuestion, "Step 1 of 3" End Sub

Similarly, you can also customize the prompt message.

You can also add line breaks in the prompt message.

In the below code, I have added a line break using ‘vbNewLine’.

Sub MsgBoxInformationIcon() End Sub

You can also use the carriage return character – Chr(13) – or line feed – Chr(10) to insert a new line in the prompt message.

Note that you can add a new line to the prompt message only and not the title.

So far, we have seen the examples where we have created message boxes and customized the buttons, icons, title, and prompt.

Below is a table that shows the exact values and the constant returned by the MsgBox function. You don’t need to memorize these, just be aware of it and you can use the constants which are easier to use.

Constant Value

Ok vbOk 1

Cancel vbCancel 2

Abort vbAbort 3

Retry vbRetry 4

Ignore vbIgnore 5

Yes vbYes 6

No vbNo 7

Sub MsgBoxInformationIcon() Result = MsgBox("Do you want to continue?", vbYesNo + vbQuestion) If Result = vbYes Then End If End Sub

Note: When you assign the MsgBox output to a variable, you need to put the arguments of MsgBox function in parenthesis. For example, in the line Result = MsgBox(“Do you want to continue?”, vbYesNo + vbQuestion), you can see that the arguments are within parenthesis.

If you want to further dig into the Message Box function, here is the official document on it.

You May Also Like the Following Excel VBA Tutorials:

You're reading Excel Vba Msgbox – All You Need To Know!

Amazon 5G: All You Need To Know

Amazon is known for its place as the biggest online retailer in the world, but over the years the company has been investing into other areas of interest, the latest of which is said to be 5G technology.

5G is seen as the future of the tech industry and given Amazon’s role in this industry, it’s no surprise that stories of Amazon 5G are also popping up. What is interesting, though, is why a giant online retailer like Amazon would want to be part of the 5G story that is predominantly a telecommunications thing. But for sure, we’ll find out sooner or later.

That said, let’s check out the stories doing rounds about Amazon 5G and the potential of joining the future telecommunications industry.

Also read:

Amazon and Boost Mobile

Stories of Amazon 5G started showing up after reports emerged that Amazon could buy Boost Mobile from T-Mobile and Sprint to form a fourth carrier that’s needed to see through the much-talked-about merger between the latter two.

The facts that Amazon buying Boost Mobile would allow the retailer to use New T-Mobiles wireless network for 6+ years as well as acquire any wireless spectrum that could be divested are said to be playing a major role in Amazons desire to join the telecommunications industry.

Boost is said to have about 8 million active users, which could be a great starting point for Amazon 5G. Apparently, Amazon will have to pay about $3 billion for this, although the figure could rise to $4.5 billion including wireless spectrum.

Amazon phone calling experience

Amazon started out selling books and has since grown into a one-stop shop for all your shopping needs. The company is also known for not shying away from trying out new ventures – efforts that have led it to offer phone calls via its Echo Connect.

Here, Echo Connect uses your home phone service to allow smart voice speakers that use Alexa to place phone calls. This means the retailer has been building experience already, with the acquisition of a wireless network probably the last piece in the puzzle.

Amazon cloud services

What better way of doing this than taking on carriers like Verizon via a channel that will also take it a giant step ahead of rival cloud providers like Microsoft?

5G-enabled Amazon devices

Amazon has a wide range of devices already selling in the market and apparently, it’s expected to come in with 5G-enabled devices in the future. When these devices arrive, Amazon wants them to connect to its cloud where data is stored and in the event that it also controls wireless network, customers will be able to buy a complete package of 5G devices from one place and vendor

Analyst Colby Synesael believes the idea behind Amazon acquiring Boost Mobile is that “it expects 5G to be integral to cloud services in the future for industries like healthcare and autos, which will use 5G-enabled devices.”

Amazon 5G rumors are also showing up at a time when Amazon in May 2023 revealed plans to set up more than 3000 satellites that will provide internet access to rural places across the globe.

It isn’t the first time that Amazon would be attempting something similar. Over a decade ago, the retailer launched the first Kindle reading device that let users connect to the company’s Whispernet 3G wireless service and download books over the air.

In 2014, the Fire Phone was unveiled to take on the iPhone, but we all know how that turned out.

Whatever Amazon 5G is all about is still a mystery for now, but we’ll definitely get new details about it in the coming weeks.


Safe Mode On Android – All You Need To Know

Safe mode on Android – All You Need to Know

In situations like these, one way is to get rid of all the junk that’s making your device heavy.

While safe mode on Android could be your bet to tackle the issue, you can also try apps that make it easy for you to get rid of junk out of your smartphone in no time at all.

How to Get Rid of Junk in Android Using Apps? Safe Mode, A Special and Powerful mode on Android

This can prove to be quite medicinal, read on to know why?

1. First, What is Safe mode on Android ?

Third party apps like calendars, widgets, heavily skinned launchers and other such apps can slow your Android phone down or worse, they could become a major cause of why your Android phone may be crashing down abruptly. Safe mode on Android prevents any third party apps from popping up on your screen as soon as you turn your smartphone on.

When you boot your Android device in safe mode, your device will only run default apps. It will not run any third-party apps such as any highly intensive widgets that could be crashing your device.

Note: While it does prevent your device from running slow or crashing down, it should not be treated as the final solution.

Having said that, Android safe mode can be considered as a mode using which you can get a clear picture of the issues pertaining to the software of your device that are making your device slow or causing any other issues which can’t be tracked when your device is running under normal circumstances.    

2. How to Turn Safe Mode On in Android ?

The process of turning on the safe mode on Android may differ from one device model to another. Here’s a probable way you can turn on the safe mode –

1. Long press the power button.

2. From the options that pop up on your screen and which prompt you to either “Power off”, “Restart” device or choose “Airplane Mode”, long press “Power off”.

3. What Can be Done In Safe Mode?

As mentioned earlier, Safe mode makes it easy for you to zoom into problematic apps and uninstall them one by one. You can also test your apps to check if they are running smoothly or not. You can particularly uninstall those apps that automatically pop up when you boot your device such as calendars, clocks and other widgets.

You may also have a look at the recently installed apps. This can be useful if you have very recently started to observe issues.

4. How to Turn Off Safe mode on Android?

After you are sure that the safe mode has worked out the magic for you and that now your phone will work smoothly, you may exit this special mode on Android.

To get out of the safe mode on Android follow the simple steps as mentioned below –

1. Long press the power button

2. Select “Restart”

That’s it, the device will now run in normal mode.

To Conclude

Safe mode is a special mode on Android that might not just help fix small issues like testing faulty operations or helping detect faulty apps, it can even detect grave problems like why there’s unusual loss of battery or why the call button is not functioning.

In case you are still facing issues, it may be time to perform a factory reset or contact your phone’s manufacturer.

Subscribe to our YouTube channel to stay updated with tech related information

Quick Reaction:

About the author

Sarang Bhargava

Does Oneplus Watch Have Always On Display (Aod)? All You Need To Know

The newly launched OnePlus Watch has been the topic of many discussions on official and unofficial forums and community boards. The furor has to do with Always-On-Display (AOD) – a much-requested feature that the company has been trying hard to deliver for a while now without hurting other components like battery life. But even without it, one cannot help but admire the remarkable smartwatch that OnePlus has delivered. 

That said, there is still a pretty high chance that the smartwatch might get this feature yet. Here is everything that you need to know about the feature that the OnePlus community is dying to see and what the company has to say about it.

What the OnePlus forum FAQ reveals?

Nope, it doesn’t.

Most smartphones nowadays have the AOD feature that lets users see the time without having to move their phones. But a smartphone’s battery life can afford the power that such a feature demands. Having the same on a smartwatch is a different ballgame altogether. 

The 1.39-inch AMOLED display of the OnePlus Watch wakes up as it detects movement, such as when you raise your arm or push the side buttons. But there is always a delay between the action and the response and that is a major inconvenience. Had there been support for AOD, the smartwatch would have truly lived up to the second half of its name. It is still a watch that we’re talking about so it should have its display on all the time, just as regular, non-smart watches do.  

Although the OnePlus Watch didn’t arrive with AOD, a possible over-the-air (OTA) update could change that in the future. The outpour of requests and feedback has forced the company to reconsider the AOD feature. In their One Plus Watch Deep Dive and FAQ, the company revealed its plans for the feature update. 

The biggest hurdle to AOD seems to be the battery life which, as the forum post revealed, could go down by half with this feature. That “could make or break the user’s experience with their smartwatch”. Since OnePlus has made it a point to deliver good in terms of battery life, much work has to go into AOD battery optimization before it sees the light of day.

The OnePlus team is currently assessing AOD’s power consumption and evaluating the likelihood of it being introduced in a future OTA. However, given that the smartwatch can deliver up to 2-weeks of battery life on a single charge, AOD is a viable option to have even if cuts down battery life by half. 

OnePlus Watch Specifications

The AOD feature notwithstanding, the OnePlus Watch has some truly unbelievable specs and features that would make it worth anyone’s money. These include, but are not limited to, Sp02 oxygen saturation monitoring (handy for our pandemic-ridden age), rapid heart rate alerts, stress detection, sedentary reminders, and more than a hundred workout models to keep you in good shape. 

On top of that, the smartwatch has 5ATM water resistance, standalone GPS and Bluetooth for easy navigation and connectivity, and an IP68-certified construction for dust and water resistance. The circular display of the OnePlus Watch has a 2.5D curved glass that nestles in the case smoothly. The watch also substitutes for a remote for those who own the OnePlus TV and turns off the TV automatically if it detects you’ve been asleep for more than half an hour.

The massive 405mAh battery is the best of the lot, delivering up to 24 hours of use with only 5 minutes of charge, thanks to Warp Charge – OnePlus’ fastest charging technology. It is this facet that has kept our hopes up of seeing the AOD become available in a future update. 

Currently, the company is working to optimize the display and increase the frame rate to 50fps. That, along with a possible OTA update for AOD will definitely put a dent in the smartwatch’s battery life. But only time and (continuous user feedback) will tell how soon this will become available. Do let the folks at OnePlus know “how important AOD is to you, considering that it could increase power consumption by almost 50%”.

Equity Release – Everything You Need To Know

Times are tight at the moment, with bills on the rise and supermarket shops getting more expensive by the day. Pensions aren’t getting any larger for those on or nearing retirement – but there are ways for you to unlock finances for later life without borrowing money you don’t have, one major example of which is equity release. But what is equity release, and how exactly does it work?

What is Equity Release?

In essence, equity release enables you to unlock the value of your biggest investment without having to sell it; the value of the loan can be recouped via monthly repayments, or the sale of the home when you move out or enter long-term care. Equity releases are paid back with interest, but you can choose to pay for just the interest in order to make the most of your money.

How Do People Utilise Equity Release?

Equity release, whichever scheme is chosen, enables you and your partner the freedom to live in your property right up until you move out, or pass away. Free from the worries of subsisting on pension payments alone, you are able to use your equity to live life comfortably, or afford passion projects and life experiences you may not otherwise have been able to.

What to Consider Before Releasing Equity

While releasing equity can make a significant difference to your quality of living, it is a serious decision to make with a number of potential ramifications. Borrowing the entirety of your home’s equity in one can result in extensive interest payments down the line, as compound interest on your property’s value guarantees a large sum of interest over time.

Oxygenos 13: Everything You Need To Know

OxygenOS was once a shining light in the Android world back when OnePlus launched the OnePlus One in 2014. Its sensible tweaks to the operating system made it better than what Google or Samsung could muster at the time and sent OnePlus stratospheric.

But in the past couple of years BBK Group, the owner of OnePlus and Oppo, decided to merge the two brand’s software teams. Now, OxygenOS is heavily based on Oppo’s ColorOS, resulting in a change of aesthetic and function for new and existing OnePlus phones.

It has been a contentious decision to many of OnePlus’s loyal fanbase, but the company has aspirations beyond remaining an enthusiast brand – it wants to sell big, and this one of the ways it has decided to try and scale.

“The classic OxygenOS was a testament to our unwavering commitment to providing you with ease of use,” the company said.

“While retaining the well-loved features from the original OxygenOS, we have amped up these features with our signature burdenless design philosophy and the charm of OnePlus.”

At an event in New York City on 3 August for the launch of the OnePlus 10T, OnePlus took the wraps off OxygenOS. We were there to soak up all that is new with the company’s take on Android 13.

Here’s everything you need to know about OxygenOS 13.

When will OxygenOS 13 be released?

OxygenOS 13 will be pushed out first to the OnePlus 10 Pro later in 2023, with the new OnePlus 10T also getting it before the year’s end. No specific dates were announced.

Which phones will get OxygenOS and when?

It seems likely that the other phones to receive OxygenOS 13 will get it at some point in 2023. Pleasingly, it’s a long list. Here’s a full rundown of the phones OnePlus said will get OxygenOS 13:


OnePlus 10 Pro

OnePlus 10T

2023 and later

OnePlus 8

OnePlus 8 Pro

OnePlus 8T

OnePlus 9

OnePlus 9 Pro

OnePlus 9R

OnePlus 9RT

OnePlus 10R

OnePlus Nord 2

OnePlus Nord 2T

OnePlus Nord CE

OnePlus Nord CE 2

OnePlus Nord CE 2 Lite

This is a solid list of phones dating back to 2023’s OnePlus 8 series, but OnePlus has had issues delivering its software promises in recent years. Notably, owners of the OnePlus 7 and 7T series have been left hanging with very late updates.

Perhaps therefore BBK made the call to pool ColorOS and OxygenOS together, so Oppo’s software development team can inform much of the work for OxygenOS in order to get platform updates out quicker.

What features are in OxygenOS 13?

OnePlus says the new OS is based on “aquamorphic design” based on the look of water and promises “soothing fonts, minimalist icons, natural and rounded shapes, and a wide range of forms and textures.”


More specifically, icons and widgets will now be softer in shape and look, and widget will expand after a long press.

They’ll also be available via Smart Launcher, a feature that displays folder contents larger on the phone’s screen.


And in a small nod to the fact OxygenOS is now built on the base of sister company Oppo’s ColorOS, OxygenOS 13 will get the Sidebar Toolbox feature from ColorOS that lets you add shortcuts to apps in a tab to the side of the screen designed to be reached with one hand.


The colours in OxygenOS 13 will also shift depending on the time of day, it’ll be brighter in the morning and take things darker come nightfall.

Another cool visual update comes in OnePlus’s always-on display (AOD) choices. OnePlus told Tech Advisor the idea for a new music control AOD came from feedback from fans in the OnePlus community online. It’ll include song title, artist, and album art, and means you’ll be able to control everything without unlocking your phone.


There will also be the option to add information like food delivery information from an app to the AOD, which will show a live tracking map and other data, all while the phone remains locked.

Zen mode is OnePlus’s existing mode that locks off distracting apps and services from the user to help them concentrate on work and life. In Oxygen OS 13 you can set the time you don’t want to be bothered or pinged, backed up with improved visuals.

This also includes standard newer Android features like Nearby Share for file sharing.

It adds what it calls AI system booster, which says it boasts intelligent memory management smarts to help improve multitasking.

For the hardcore gamers, the OS also has HyperBoost Gaming Engine to better stabilise gameplay and improve frame rate consistency.

If music is more your thing, OxygenOS 13 supports spatial audio to adjust the direction of sound across different apps, though this depends on the hardware. Add in Dolby Atmos support and phones that run the software should be sounding tip top, and to listen to it all, OnePlus will add Fast Pair and Audio Switch updates to quicker connect to wireless headphones and switch their audio output.

We’ll be sure to dive into OxygenOS 13 when it starts rolling out to the OnePlus 10 Pro later in the year.

Update the detailed information about Excel Vba Msgbox – All You Need To Know! on the 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!