S
S
sanik22015-12-01 17:16:29
Visual Basic
sanik2, 2015-12-01 17:16:29

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

2 answer(s)
A
Anton Fedoryan, 2015-12-02
@AnnTHony

How to do it?

Finding the maximum element
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

R
Roman Sidorin, 2015-12-21
@RSidorin

If the arrays are in cells, then it is possible without VBA.
One dimensional array
Two dimensional array
1f12e1e6a8ef48beac5b3947404dc71c.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question