Macro Intro
This is an Excel macro that will find the Largest and Smallest values in a Workbook. By Default, this Excel macro will loop through the entire Active Workbook. Once this Excel macro finishes a Message Box will display the Active Workbook that was searched and the Max and Min values found. It is easy to customize the Excel Find Largest and Smallest Value macro to only search through a specific range of cells for these values. This macro can stand alone or be used as a function within existing macros. With some additional updates to the VBA code you can have this Excel macro fire every time an Excel Workbook opens! No longer do you need to sort or use conditional formatting to identify the Largest and Smallest values in Excel. There is a better way with VBA so start using the Excel Find Largest and Smallest Value today!Use the following link to download the Excel Workbook seen in the videos below: Fruit Inventory Status
See it in Action
Watch this video to see this macro in action.Code
Here is the code for this macro. Make sure the following References are setup before running it: Visual Basic For Applications, Microsoft Excel 16.0 Object LibraryCustomization
These segments of code can be customized to personalize this macro.You can also call this Excel macro immediately when a Workbook opened by pasting this code into the ThisWorkbook portion of Visual Basic.[code lang=”vb”]Sub Workbook_Open() ‘Call MacroName Call FindLargestSmallestValue End Sub[/code]Details to Customize
Update the Current Max value if a new one is found.
Update the Current Min value if a new one is found.
Set the initial Current Min found on the first instance of the Rng.
This is the MsgBox that will display once this macro finishes.