title: Copying multiple ranges and concatenating them in Excel
body: <p>My Excel sheet has multiple used ranges. I want to copy each range value and concatenate them. What I did is</p>
  
  <pre><code>Set tempRange = Union(SrcWkb.Worksheets("mysheet").Range("F1:H1"), SrcWkb.Worksheets("mysheet").Range("I1:J1"), SrcWkb.Worksheets("NWP").Range("K1:L1"))
  
  For Each eachRange In tempRange
    tempString = tempString &amp; eachRange &amp; "/"
    MsgBox tempString
  Next eachRange
  </code></pre>
  
  <p>I want to copy the value in merged cells F1:H1 and concatenate a "/" and value from I1:J1 (also merged) and K1 to L1. However, Excel throws "subscript out of range" error. How could I achieve this?</p>
  
  <p><img src="https://i.stack.imgur.com/0CD81.png" alt="screenshot"></p>