Hallo Leute, ich habe folgendes funktionierendes Codefragment, welches abwecheseln de den Inhalt aus den Spalten A und B in einer Textbox darstellt:

Sub MehrereSpaltenZeilenweiseInTextbox()
    Dim i As Long, j As Long
    Dim varQ As Variant, varZ() As Variant
   varQ = Range("A1:B9").Value
   ReDim varZ(1 To UBound(varQ, 1) * UBound(varQ, 2))
   For i = 1 To UBound(varQ, 1)
   For j = 1 To UBound(varQ, 2)
    varZ(i * UBound(varQ, 2) - UBound(varQ, 2) + j) = varQ(i, j)
   Next j
   Next i
 TextBox1 = Join(varZ, vbNewLine)
  End Sub

Das entscheidende ist diese Formel:

varZ(i * UBound(varQ, 2) - UBound(varQ, 2) + j) = varQ(i, j)

Wie kann ich diese Formel herleiten? Hat jemand eine Idee? Die Formel ist richtig, alles funktioniert toll, aber wie leite ich sie her?