In this brief article, you will learn the simple steps to highlight min value in the selection using Macros in Excel Office 365. VBA & Macros plays a vital role in Excel. Because it is used for completing any kind of task with a few clicks. You just follow the steps given below to achieve the task.
Highlight Min Value in Selection Using Macros:
Follow the below instructions to highlight the smallest value in the range in Excel.
- In the following image, you can see the set values in a range from B1:B10. We are going to find the smallest one from this input range.
- On the Developer Tab, select the Visual Basic option under the Code section.
- Then you need to copy and paste the code given below.
VBA code to highlight min value using Macros
Sub HighlightMinValue()
Dim cell As Range
For Each cell In Selection
If cell = WorksheetFunction.Min(Selection) Then
cell.Style = “Note”
End If
Next cell
End Sub
- You need to save the code by selecting it. Then close the window.
- You have to open the sheet containing the data. On the Developer Tab, choose the Macros option in the Code section.
- You need to make sure that your macro is selected and click the Run button.
- At last, you will get the result as shown in the below screenshot.
Sum-Up:
To be crisp, you can understand the simple steps to highlight min value in the selection using Macros in Excel Office 365. Drop your feedback in the below comment section. Thanks for visiting Geek Excel. Keep Learning!
Top comments (0)