title: VBA Matching duplicate results in array and writing them in missing cells
body: <p>I have a 2 dimensional (x, y) array with names of issuers and their ratings.</p>
  
  <pre><code>MBANK   BBB
  0   NR
  QUERCUS TFI PL  0
  SCHRODER INVMGMT    0
  0   NR
  NEWAG   0
  GRUPA DUON  0
  BZ WBK TFI  0
  LEGG MASON PL   0
  POLAND  0
  POLAND  0
  POLAND  0
  CIECH SA    0
  ERBUD SA    0
  MBANK   BBB
  DB LONDON   BBB+
  DB LONDON   0
  PIONEER PEKAO   0
  MBANK   BBB
  TFI PL  0
  ELEMENTAL HLDG  0
  MONNARI TRADE   0
  MIDAS SA    0
  PE MGMS SA  0
  MOSTOSTAL ZABRZE    0
  LC CORP 0
  BANK HANDLOWY W NR
  POLAND  A
  MBANK   0
  </code></pre>
  
  <p>Unfortunately, the software that generates this list is flawed and does not give all the isuers ratings, sometimes writing a 0.</p>
  
  <p>My goal is to have the issuers (with the exact same name) have the same rating in the entire array.  In the example provided, MBANK has a rating BBB but in the last entry MBANK has a 0.  My code so far:</p>
  
  <pre><code>'rating
  ReDim rating_array(n, 2)
  For x = 1 To n
          rating_array(x, 1) = ThisWorkbook.Sheets("SAP BW Data").Cells(1 + x, 21) 'issuer group names
          rating_array(x, 2) = ThisWorkbook.Sheets("SAP BW Data").Cells(1 + x, 34) 'ratings
  Next x
  
  
  For i = 1 To UBound(rating_array)
      If rating_array(i, 1) = 0 Then
          Issuer = rating_array(i, 2) 'issuer group name with blank rating
          'to do: search through the array, find "Issuer", if at least one has a rating, give all "Issuer" the same rating.
  </code></pre>
  
  <p><strong>My goal:</strong> is to search through the array, find that MBANK has a 0 at the bottom, then I want to look through all the entries with MBANK and find the one where there is a rating (in this case it would be the first entry - BBB) and have that rating replace all the MBANK's which currently have 0.  The way the data is generated, there shouldn't be any situation, where there would be entries with different ratings under the same name.  Also, my list is about 1500 items long, so the function should be relatively smooth as there's a lot of other stuff also going on in code ;).</p>
  
  <p>Not sure how to handle the "search for and replace" part of the code.  I would appreciate some tips on this!</p>