Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to select MIN MAX from selection
If the user hits the command button, what would be the macro to find
the minimum and maximum of the users selection. In excel front end, it is done by using = min( ) and =max( ) Can the code be tweaked to ignore any alphabets/words from the selection and find the min and max for the only the numbers in the selection? I would appreciate anyone willing to assist me in this. Marvin |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to select MIN MAX from selection
Sub getMinMax()
Dim minValue As Double Dim maxValue As Double maxValue = WorksheetFunction.Max(Selection) minValue = WorksheetFunction.Min(Selection) MsgBox "minimum value: " & minValue & Chr(10) & _ "maximum value: " & maxValue End Sub wrote: If the user hits the command button, what would be the macro to find the minimum and maximum of the users selection. In excel front end, it is done by using = min( ) and =max( ) Can the code be tweaked to ignore any alphabets/words from the selection and find the min and max for the only the numbers in the selection? I would appreciate anyone willing to assist me in this. Marvin |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to select MIN MAX from selection
Jeff, Thanks. Is there any way to ignore the #DIV/0! in the selection
and return the min and max of the selection? On Oct 18, 11:28 am, JW wrote: Sub getMinMax() Dim minValue As Double Dim maxValue As Double maxValue = WorksheetFunction.Max(Selection) minValue = WorksheetFunction.Min(Selection) MsgBox "minimum value: " & minValue & Chr(10) & _ "maximum value: " & maxValue End Sub wrote: If the user hits the command button, what would be the macro to find the minimum and maximum of the users selection. In excel front end, it is done by using = min( ) and =max( ) Can the code be tweaked to ignore any alphabets/words from the selection and find the min and max for the only the numbers in the selection? I would appreciate anyone willing to assist me in this. Marvin |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to select MIN MAX from selection
I would STRONGLY urge that you handle the DIV/0 error in your
formula. You can do this using IsErr, IsError, or an Or statement. =IF(OR(A2=0,B2=0),0,A2/B2) =IF(ISERR(A2/B2),0,A2/B2) wrote: Jeff, Thanks. Is there any way to ignore the #DIV/0! in the selection and return the min and max of the selection? On Oct 18, 11:28 am, JW wrote: Sub getMinMax() Dim minValue As Double Dim maxValue As Double maxValue = WorksheetFunction.Max(Selection) minValue = WorksheetFunction.Min(Selection) MsgBox "minimum value: " & minValue & Chr(10) & _ "maximum value: " & maxValue End Sub wrote: If the user hits the command button, what would be the macro to find the minimum and maximum of the users selection. In excel front end, it is done by using = min( ) and =max( ) Can the code be tweaked to ignore any alphabets/words from the selection and find the min and max for the only the numbers in the selection? I would appreciate anyone willing to assist me in this. Marvin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SELECT DUPLICATE IN SELECTION | Excel Worksheet Functions | |||
Range(Selection, Selection.End(xlToRight)).Select | Excel Programming | |||
Select another Textbox After Selection | Excel Programming | |||
Macro to select cells and then new selection from selected cells | Excel Programming | |||
Selection.End(xlToLeft).Select | Excel Programming |