How to Add an Input Message in Data Validation in Excel office 365?
Tags: toaddaninputmessagei, vbamacros
Published: 2021-09-16 02:28:36

---
title: How to Add an Input Message in Data Validation in Excel office 365?
published: true
date: 2021-09-15 12:47:50 UTC
tags: ToAddAnInputMessageI,VBAMacros
canonical_url: https://geekexcel.com/how-to-add-an-input-message-in-data-validation-in-excel-office-365/
---

In this tutorial, we will guide you on how to **add an Input message in Data Validation** in Excel Office 365. Let’s get them below!! Get an official version of MS Excel from the following link: **[https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)**

## Example

- Firstly, in the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic option](https://geekexcel.com/wp-content/uploads/2020/09/1-106.png)<figcaption>Select the Visual Basic option</figcaption>

- Now, you have to  **copy and paste the code**  given below.

```
Sub DropDownFilter()
Dim lastrow As Long
lastrow = Worksheets("sheet1").Cells(Rows.Count, "D").End(xlUp).Row

    With Range("A1:A10").Validation
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=$D$2:$D" & lastrow
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = "Message"
    .InputMessage = "Enter only countries name"
    Range("A1:A10").Interior.ColorIndex = 37
    End With
End Sub

```

- After that, you need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-41-1024x315.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- You need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://geekexcel.com/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Then, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.

![](https://geekexcel.com/wp-content/uploads/2021/09/Run-the-Code-22.png)<figcaption>Run the Code</figcaption>

- Now, the **drop-down list** will be created for the **countries** and also the cell will be **filled with color**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Drop-down-list.png)<figcaption>Drop-down List</figcaption>

- Here, whenever you **enter the new country name** in the range, the **drop-down list** will pick the **country name** automatically.

![](https://geekexcel.com/wp-content/uploads/2021/09/Enter-the-Country-Name.png)<figcaption>Enter the Country Name</figcaption>

- Finally, the **message** will appear in the selected cell in the **range of A1:A10**.

## End of Era

We hope that this tutorial gives you guidelines on how to **add an Input message in Data Validation** in Excel Office 365 **. ** Please leave a comment in case of any  **queries,**  and don’t forget to mention your valuable  **suggestions**  as well. Thank you so much for Visiting Our Site!! Continue learning on **[Geek Excel](https://geekexcel.com/)!! **Read more on [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

**Read Next:**

- **[How to use the XNPV function in Excel office 365?](https://geekexcel.com/how-to-use-the-xnpv-function-in-excel-office-365/)**
- **[Excel Formulas to Highlight the Cells that End with Given Value!!](https://geekexcel.com/excel-formulas-to-highlight-cells-end-with/)**
- **[Excel Shortcut for “Select to End of Cell” in the Worksheet!!](https://geekexcel.com/quick-excel-shortcut-for-select-to-end-of-cell-in-a-worksheet/)**
- **[Excel Shortcuts: Delete to the End of Line in the Spreadsheet!!](https://geekexcel.com/shortcuts-for-delete-to-the-end-of-line-in-ms-excel-365/)**
- **[Excel Formulas for Counting Cells that End with certain character or text!!](https://geekexcel.com/excel-formulas-for-counting-cells-that-end-with-certain-character-or-text/)**