Vba Help With A Solution

R

RELWOD85

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
 
N

Norman Jones

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top