ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vba Help With A Solution (https://www.excelbanter.com/excel-programming/335974-vba-help-solution.html)

RELWOD85

Vba Help With A Solution
 

HI THERE IM HAVING TROUBLE PRODUCING SOME VBA CODING IN MICROSOFT EXCE
THAT WILL IMPLIMENT THE FOLLOWING CODE, I WOULD BE GREATFULL IF ANYON
COULD HELP ME ON THIS A.S.A.P BECAUSE I AM NEW TO USING VBA AND FINDIN
IT ALL VERY CONFUSING :confused: undefined

SET maximum value=0
LOOP
INPUT a score between 1-10
IF the maximum value is smaller than the input score
SET maximum value=input score
END IF
END LOOP(repeat 4 times)
DISPLAY the maximum value with a suitable messag

--
RELWOD8
-----------------------------------------------------------------------
RELWOD85's Profile: http://www.excelforum.com/member.php...fo&userid=2575
View this thread: http://www.excelforum.com/showthread.php?threadid=39163


Norman Jones

Vba Help With A Solution
 
Hi Relwod85.

Try something like:

Public Sub Tester()
Dim i As Long
Dim arr As Variant
Dim myVal As Double
Static MyMax As Variant

MyMax = 0

arr = Array("FIRST", "SECOND", "THIRD", "LAST")

For i = 1 To 4

myVal = Application.InputBox( _
prompt:="Please enter a " & _
arr(i - 1) & " number", _
Type:=2, _
Title:="Find Maximum", _
Default:=0)

MyMax = Application.Max(myVal, MyMax)

Next i

MsgBox "Your highest entry was: " & MyMax

End Sub

BTW, Please try to avoid upper case communication: in NG parlance this
equates to shouting and, in any event, is uncommonly difficult to read!

---
Regards,
Norman



"RELWOD85" wrote in
message ...

HI THERE IM HAVING TROUBLE PRODUCING SOME VBA CODING IN MICROSOFT EXCEL
THAT WILL IMPLIMENT THE FOLLOWING CODE, I WOULD BE GREATFULL IF ANYONE
COULD HELP ME ON THIS A.S.A.P BECAUSE I AM NEW TO USING VBA AND FINDING
IT ALL VERY CONFUSING :confused: undefined

SET maximum value=0
LOOP
INPUT a score between 1-10
IF the maximum value is smaller than the input score
SET maximum value=input score
END IF
END LOOP(repeat 4 times)
DISPLAY the maximum value with a suitable message


--
RELWOD85
------------------------------------------------------------------------
RELWOD85's Profile:
http://www.excelforum.com/member.php...o&userid=25753
View this thread: http://www.excelforum.com/showthread...hreadid=391632




Norman Jones

Vba Help With A Solution
 
Hi Relwod,

Change:

Type:=2, _


to

Type:=1, _
---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Relwod85.

Try something like:

Public Sub Tester()
Dim i As Long
Dim arr As Variant
Dim myVal As Double
Static MyMax As Variant

MyMax = 0

arr = Array("FIRST", "SECOND", "THIRD", "LAST")

For i = 1 To 4

myVal = Application.InputBox( _
prompt:="Please enter a " & _
arr(i - 1) & " number", _
Type:=2, _
Title:="Find Maximum", _
Default:=0)

MyMax = Application.Max(myVal, MyMax)

Next i

MsgBox "Your highest entry was: " & MyMax

End Sub

BTW, Please try to avoid upper case communication: in NG parlance this
equates to shouting and, in any event, is uncommonly difficult to read!

---
Regards,
Norman





All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com