title: Write from array to cells using Excel VBA
body: <p>I need to write from an array to Excel cells down.</p>
  
  <p>I have three values in the array and I would like to write it in cells that it will look like that:</p>
  
  <pre>
  EUR
  GBP
  USD
  </pre>
  
  <p>Code:</p>
  
  <pre><code>On Error Resume Next
  For Each element In CurrencyArray
      myCollection.Add Item:=element, Key:=element
  Next element
  On Error GoTo 0
  
  ReDim CurrencyArray(1 To myCollection.Count)
  For element = 1 To myCollection.Count
     CurrencyArray(element) = myCollection(element)
  Next element
  
  
  Set Summary = Range("M1")
  Summary.Value = "Sum Currency"
  </code></pre>
  
  <p>At this point I would like to write the values to the cells.</p>
  
  <pre><code>ReDim CurrencyArray(0 To myCollection.Count, 1 To 1)
  For element = 1 To myCollection.Count
  CurrencyArray(element, 1) = myCollection(element)
  Next element
  
  
  CurrencyArray(0, 1) = "Sum Currency"
  
  Set Summary = Range("M1").Resize(UBound(CurrencyArray, 1) + 1)
  'Sum currency values
  Dim Count As Integer
  Dim SumArray As Variant
  
  For Each element In CurrencyArray
   For Count = 2 To lRow
      If ws.Cells(Count, 5) = element Then
        SumArray = SumArray + ws.Cells(Count, 6)
      End If
   Next Count
  Next element
  
  
  Summary.Value = CurrencyArray
  </code></pre>
  
  <p>It should look like:</p>
  
  <pre><code>EUR 1000
  GBP 500
  YEN 100
  </code></pre>
  
  <p>The problem is that I have a spreadsheet with different values, but I'm not allowed to edit the spreadsheet except with VBA.</p>
  
  <pre>
  Currency Amount  
  EUR      1000  
  EUR      100  
  EUR      12  
  EUR      70  
  GBP      40  
  GBP      20
  </pre>
  
  <p>I have to filter the different currencys and sum up the amounts of the currencys. Then I would like to set it to the right site of the excel sheet.</p>
  
  <pre>
  EUR      1182  
  GBP      60
  </pre>
  
  <p>but I don't know in advance how many currencies will be there or how big the amount is. At first I would like to filter the duplicates and then sum up the amounts of money depending on the currency.</p>