title: using VBA Macro in Excel , reseting variable will reset cell value
body: <p>I'm trying to write a macro to concatenate cells with bold text in one cell.</p>
  
  <pre><code>Sub question_concat()
  
  Dim s1 As String
  Dim first As Boolean
  Dim r As Long
  
  r = 1
  For Each c In Selection
      If c.Font.Bold = True Then
          If first = True Then
              r = c.Row
              first = False
          End If
          s1 = s1 &amp; c.Value
      Else
          Cells(r, 3).Value2 = s1
          first = True
          s1 = ""
      End If
  Next
  
  End Sub
  </code></pre>
  
  <p>At first it sets value of 3rd column equal to s1, but after clearing s1 for next loop <code>s1 = ""</code> , value of cell also clears.</p>