Highlight Max Value in Selection using Macros (VBA) in Excel 365!!
Tags: highlightthemaxvalue, vbamacros
Published: 2021-02-16 07:03:18

---
title: Highlight Max Value in Selection using Macros (VBA) in Excel 365!!
published: true
date: 2021-02-16 07:01:28 UTC
tags: Highlightthemaxvalue,VBAMacros
canonical_url: https://geekexcel.com/highlight-max-value-in-selection-using-macros-vba-in-excel-365/
---

In this tutorial, we are going to look at how to highlight the largest value in the selected range with Macros in Excel. [VBA](https://geekexcel.com/excel-office-365-vba-overview-definition-and-examples/) **& Macros** will make this work as simple as possible. Because we are going to do this with a few clicks. Let’s see the clear-cut instructions to **highlight the [max](https://geekexcel.com/how-to-use-excel-max-function-in-office-365-with-examples/) value in Selection using Macros** in Excel Office 365.
## Highlight Max Value in the Selection:

To select or highlight the largest value in the range, do as follows.

- In the below image, you can see the set of input values in the range **B1:B10**. We are going to find and highlight the largest value from this range.

![Example](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_VvW6xpLmtc.png)<figcaption id="caption-attachment-21907">Example</figcaption>

- On the **Developer Tab, select** the **Visual Basic** option under the **Code** section.

![Select Visual Basic option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/09/Select-Visual-Basic-option-4.png)<figcaption id="caption-attachment-14755">Select the Visual Basic option</figcaption>

- Then you need to copy and paste the code given below.

VBA code to highlight max value using Macros

Sub HighlightMaxVal()

Dim cell As Range

For Each cell In Selection

If cell = WorksheetFunction.Max(Selection) Then

cell.Style = “Note”

End If

Next cell

End Sub

- You need to **save the code** by selecting it. Then **close** the **window.**

![Save the code](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_1OVw1PVtD2.png)<figcaption id="caption-attachment-21941">Save the code</figcaption>

- You have to open the sheet containing the data. On the **Developer Tab, choose** the **Macros option** in the **Code** section.

![Choose the Macros option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/09/Choose-the-Macros-option-2.png)<figcaption id="caption-attachment-14747">Choose the Macros option</figcaption>

- You need to make sure that your macro is selected and **click** the **Run** button.

![Macros dialog box](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_U6QxsUZfHQ.png)<figcaption id="caption-attachment-21942">Macros dialog box</figcaption>

- At last, you will get the result as shown in the below screenshot.

![Result](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_6REAJDj0rM.png)<figcaption id="caption-attachment-21943">Result</figcaption>

## Summary:

In this tutorial, we have demonstrated the clear-cut instructions to **highlight the max value in Selection using Macros** in Excel Office 365. Leave your **feedback** in the below comment section. Thanks for visiting **[Geek Excel.](https://geekexcel.com/)** Keep Learning!

#### Also Read:

- [Convert Formulas into Values using Macros (VBA) in Excel 365!!](https://geekexcel.com/convert-formulas-into-values-using-macros-vba-in-excel-365/)
- [Reverse Text Function using Macros (VBA) in Excel Office 365!!](https://geekexcel.com/reverse-text-function-using-macros-vba-in-excel-office-365/)
- [Highlight Min Value in Selection Using Macros in Excel Office 365!!](https://geekexcel.com/highlight-min-value-in-selection-using-macros-in-excel-office-365/)