Answer the question
In order to leave comments, you need to log in
Excel VBA script task?
Problem: Two arrays are given. Determine if there is the largest element of array A among the elements of array B.
How to do this? Who can do something like this?
Answer the question
In order to leave comments, you need to log in
How to do it?
Sub max_el()
Dim i, j, max As Integer
' Cells in A
i = 11
j = 1
max = 0
While (j <= i)
If (max < Cells(j, 1)) Then max = Cells(j, 1)
j = j + 1
Wend
Cells(14, 1) = max
' Cells in B
i = 11
j = 1
While (j <= i)
If (max = Cells(j, 2)) Then Cells(14, 2) = "Yeap"
j = j + 1
Wend
If Cells(14, 2) <> "Yeap" Then Cells(14, 2) = "Nope"
End Sub
If the arrays are in cells, then it is possible without VBA.
One dimensional array
Two dimensional array
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question