Ich will den Inhalt von 72 Label in ein Arbeitsblatt schreiben.
Die Label habe ich wie folgt benannt:
Lb_200, Lb_201, bis Lb_271
Die Label sind in 2 Blöcke mit jeweils 6 Zeilen und pro Zeile 6 Label aufgeteilt.
So will ich auch die Inhalte in ein Arbeitsblatt schreiben.
Von Zeile 28 bis Zeile 38 (jede 2. Zeile)
Spalte 4 bis 9 sowie Spalte 13 bis 18.
Mit dem u. g. Programmier-Code habe ich folgendes Ergebnis im Arbeitsblatt:
Lb_200 Lb_201 Lb_202 Lb_203 Lb_204 Lb_205 Lb_236 Lb_237 Lb_238 Lb_239 Lb_240 LB_241
Lb_206 Lb_207 u.s.w. LB_242 Lb_243 u.s.w.
Private Sub CommandButton2_Click()
Dim i As Integer 'Schleifenzähler
Dim UsFormLbLinks As Integer 'Label linker Block User-Form
Dim UsFormLbRechts As Integer 'Label rechter Block User-Form
Dim ArbSpalteLinks As Integer 'Spalte linker Block Arbeitsblatt
Dim ArbSpalteRechts As Integer 'Spalte rechter Block Arbeitsblatt
UsFormLbLinks = 199
UsFormLbRechts = 235
For ArbZeile = 28 To 38 Step 2 'Schleife für Zeilen im Arbeitsblatt
ArbSpalteLinks = 3
ArbSpalteRechts = 12
For i = 1 To 6 'Schleife für die 6 Label in User-Form / 6 Spalten in Arbeitsblatt pro _
Zeile
ArbSpalteLinks = ArbSpalteLinks + 1
ArbSpalteRechts = ArbSpalteRechts + 1
UsFormLbLinks = UsFormLbLinks + 1
UsFormLbRechts = UsFormLbRechts + 1
Worksheets("Tabelle1").Cells(ArbZeile, ArbSpalteLinks).Value = "Lb_" & UsFormLbLinks
Worksheets("Tabelle1").Cells(ArbZeile, ArbSpalteRechts).Value = "Lb_" & UsFormLbRechts
Next i
Next ArbZeile
End Sub