Hello! Is there a convenient way to check in VBA, which of my 5 Long-type variables is biggest? -TK
T Tommi Feb 3, 2004 #1 Hello! Is there a convenient way to check in VBA, which of my 5 Long-type variables is biggest? -TK
J Jake Marx Feb 3, 2004 #2 Hi TK, Yes, you can use the built-in worksheet function MAX from VBA: Sub test() Dim l1 As Long Dim l2 As Long Dim l3 As Long l1 = 1 l2 = 2 l3 = 3 MsgBox Application.WorksheetFunction.Max(l1, l2, l3) End Sub -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored]
Hi TK, Yes, you can use the built-in worksheet function MAX from VBA: Sub test() Dim l1 As Long Dim l2 As Long Dim l3 As Long l1 = 1 l2 = 2 l3 = 3 MsgBox Application.WorksheetFunction.Max(l1, l2, l3) End Sub -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored]
T Tommi Feb 3, 2004 #3 Thanks Jake! Jake Marx said: Hi TK, Yes, you can use the built-in worksheet function MAX from VBA: Sub test() Dim l1 As Long Dim l2 As Long Dim l3 As Long l1 = 1 l2 = 2 l3 = 3 MsgBox Application.WorksheetFunction.Max(l1, l2, l3) End Sub -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Hello! Is there a convenient way to check in VBA, which of my 5 Long-type variables is biggest? -TK Click to expand... Click to expand...
Thanks Jake! Jake Marx said: Hi TK, Yes, you can use the built-in worksheet function MAX from VBA: Sub test() Dim l1 As Long Dim l2 As Long Dim l3 As Long l1 = 1 l2 = 2 l3 = 3 MsgBox Application.WorksheetFunction.Max(l1, l2, l3) End Sub -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Hello! Is there a convenient way to check in VBA, which of my 5 Long-type variables is biggest? -TK Click to expand... Click to expand...