title: Copy and paste cell value to specific cells based on text in column
body: <p>I have a Excel file, its look like...</p>
  
  <p><a href="https://i.stack.imgur.com/lyzzp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lyzzp.png" alt="enter image description here"></a></p>
  
  <p>After the macros, this will be the end results:</p>
  
  <p>[<img src="https://i.stack.imgur.com/5WP8y.png" alt="2]"></p>
  
  <p>I want macro that read column "B", and paste first country from column "C" in the same cells of column "A", after he find duplicate cell in "B", he copy next country from column "C", and does the same as I wrote with first country and etc.</p>
  
  <p>I found code from similar question and tried adapt it to my task:</p>
  
  <pre><code>Sub GetText2()
  Dim CellValue As String
  Dim RowCrnt As Integer
  Dim RowMax As Integer
  
  With Sheets("Sheet1")   
    RowMax = .Cells(Rows.Count, "B").End(xlUp).Row
    For RowCrnt = 2 To RowMax
      CellValue = .Cells(RowCrnt, 2).Value
      If CellValue &lt;&gt; "" Then
        .Cells(RowCrnt, 1).Value = Cells(RowCrnt, 5)
      Else
        .Cells(RowCrnt, 1).Value = .Cells(RowCrnt - 1, 5).Value
      End If
    Next
  End With
  End Sub
  </code></pre>
  
  <p>But it does not work as it should.</p>
  
  <p>Can someone help me with these? Thanks.</p>