title: Transporting text from one worksheet to another with two Dynamic ranges- VBA Excel
body: <p>I have two worksheets (one for input and another for output) and I'm trying to copy some information on cells along a row from the input to cells along a row on the output. My code stops if, on a separated list of ranges, there's no info. The code I'm using is like that right now:</p>
  
  <pre><code>Sub Txt_Manobra()
  
  Dim x As Range
  Dim i As Integer
  Dim o As Integer
  Dim p As Integer
  Dim Txt1 As String
  Dim Txt2 As Variant
  
  For Each x In Worksheets("Formulario").Range("AK9:AK47").Cells
      If x.Value &lt;&gt; "" Then Txt1 = x.Value
          o = 8 + x.Count
          For i = 1 To 7
              p = 3 + i
              Txt2 = Worksheets("Formulario").Range(o, p).Value
              Worksheets("SdB pg1").Range(Txt1).Cells(1, i) = Txt2
          Next i
      Next x
  End Sub
  </code></pre>
  
  <p>For each range value (x), it looks on the range txt1 (That is composed of only one row), and it should copy the values on range (D9:J9), one at a time and put on the range determined x (also only one row and with the same number of columns as D9:J9) then look on the next row (D10:J10) and so on.</p>
  
  <p>I'm getting errors and I think this might be easier to do than I Think.</p>
  
  <p>It's like that:
  <a href="https://i.stack.imgur.com/hWW17.png" rel="nofollow noreferrer">Input</a></p>
  
  <p>And I want to tranfer to
  <a href="https://i.stack.imgur.com/b9Hq2.png" rel="nofollow noreferrer">Output</a></p>
  
  <p>Each cell in the range "AK9:AK47" Contains a range like "P10:V10"</p>
  
  <p>I haven't made it to work out to see if my "o" changes</p>