title: Excel VBA Looping through cells and replacing their values
body: <p>I am trying to build a macro that cycles through a column of cells and replaces a two letter country code in that cell with the name of that country. However I get an object not found error when I try to run the macro.</p>
  
  <pre><code>Sub ChangeCountryText()
  '
  ' ChangeCountryText Macro
  ' Changes country codes
  '
      For counter = 2 To 20
          Set curCell = ActiveSheet.Cells(counter, 1)
          Select Case curCell.Text
              Case "JP"
                  curCell.Text = "Japan"
              Case "FR"
                  curCell.Text = "France"
              Case "IT"
                  curCell.Text = "Italy"
              Case "US"
                  curCell.Text = "United States"
              Case "NL"
                  curCell.Text = "Netherlands"
              Case "CH"
                  curCell.Text = "Switzerland"
              Case "CA"
                  curCell.Text = "Canada"
              Case "CN"
                  curCell.Text = "China"
              Case "IN"
                  curCell.Text = "India"
              Case "SG"
                  curCell.Text = "Singapore"
          End Select
      Next counter
  
  End Sub
  </code></pre>