title: How to print array and values from new cycle to next rows
body: <p>this is part of my code that i am working with and I have one problem. I have array with values (masyvas) and i started new loop to find other values by using masyvas(i,1) values and after that i need that new values would be printed in masyvas(i,2) and i need to group them. It need to look like this:</p>
  
  <p>991988  Gaz.duon.sk"Giros"gaiv.g.1,5L   5_PETØFLAT1,5</p>
  
  <pre><code>        PALINK
  </code></pre>
  
  <p>117388  Silp.gaz.nat.min.v"Tiche'1,5L 5_PETØFLAT1,5</p>
  
  <pre><code>       PALINK
         RIMI LIETUVA
         ŠIAULIŲ TARA 
  </code></pre>
  
  <p>111388  Gaz.nat.min.v"Tiche" 1,5L pet 5_PETØFLAT1,5</p>
  
  <pre><code>       PALINK
         AIBĖS LOGISTIKA
         AIBĖS LOGISTIKA
         RIMI LIETUVA
         ŠIAULIŲ TARA 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/xqKyL.jpg" rel="nofollow noreferrer">How it looks now from marked 1 it goes wrong</a></p>
  
  <p><a href="https://i.stack.imgur.com/yQmM7.png" rel="nofollow noreferrer">Data sheet where i get array values</a></p>
  
  <p>Here is part of my code where i have this problem now it prints new values next to masyvas(i,2) but not below as I need.</p>
  
  <pre><code>lastrow2 = Sheets("lapas").Cells(Rows.Count, 1).End(xlUp).Row
  
  rub = lastrow2
  cub = 3
  
  ReDim masyvas(1 To rub, 1 To cub)
  For i = 1 To rub
     For j = 1 To cub
        masyvas(i, j) = Sheets("lapas").Cells(i, j).Value 'array gets values from filtered data in AKCIJOS sheet
     Next
  Next
  
  Sheets("lapas").Range("A1:C100").Clear
  
  
  
  For i = 1 To rub Step 1
  Set rng2 = grafikas.Cells(6 + h, 2)
  
      prekeskodas = masyvas(i, 1)
  
  
          For m = 2 To lastrow
              If akcijos.Cells(m, 8) &gt;= laikas And akcijos.Cells(m, 8) &lt;= laikas2 Then
                  If prekeskodas = akcijos.Cells(m, 4) Then
  
                  grafikas.Cells(7 + r, 2).EntireRow.Select
                  Selection.Insert Shift:=xlDown
                  grafikas.Cells(7 + r, 3) = akcijos.Cells(m, 3)
  
                  r = r + 1
                  h = r
                  End If
  
              End If
           Next m
  
      For j = 1 To cub Step 1
  
        rng2.Offset(i - 1, j - 1).Value = masyvas(i, j)
  
      Next
  
  
  Next
  </code></pre>