(Solved) – I am trying to write value to array and find maximum value of array?

  • by

How can I assign value to array and find max from array value

Sub maxpain()


sym = Sheets("Analysis Ochain").Range("A5").Value

'Column number

ccol = Application.WorksheetFunction.Match(sym & "COI", Sheets(6).Range("1:1"), 0)
pcol = Application.WorksheetFunction.Match(sym & "POI", Sheets(6).Range("1:1"), 0)

'Find last filed cell in respect of collumn number

last = Sheets(6).Columns(ccol).End(xlDown).Row - 1

'Define array from 2 to last filled cell

Dim accmu(2 To last) As Integer

'Sum of both column and assign value to array

For i = 2 To last
accmu(i) = Sheets(6).Cells(i, ccol).Value   Sheets(6).Cells(i, pcol).Value

'Get maximum value of array 

max = ??????  

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *