Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88868

I am trying to write value to array and find maximum value of array?

$
0
0

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

Sub maxpain()

'name

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 column 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
Next


'Get maximum value of array 

max = ??????  


End Sub

Viewing all articles
Browse latest Browse all 88868


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>