For-Schleife
27.02.2020 09:53:57
X
Ich habe Folgende frag: weiso wird in der 2 for Schleife s = 0 zugewiesen und nicht den Wert von Z?
Ich habe zu meiner frage nicht wirklich was im Internet gefunden.
Dies Verstehe ich nicht.
Mit Quellcode:
Option Explicit
Private Sub CommandButton1_Click()
Dim SDT As Worksheet, NTB As Worksheet
Dim LZ%, ZZ%, z%, LS%, SS%, s%, TL%, LL%, RL% 'Integer
Set SDT = ThisWorkbook.Worksheets("Data")
Set NTB = ThisWorkbook.Worksheets("Request")
ZZ = 2
SS = 1
RL = 0
LS = 0
Application.ScreenUpdating = False
With NTB
LZ = .UsedRange.SpecialCells(xlCellTypeLastCell).Row
For z = 1 To LZ
If Left(NTB.Cells(z, 2).Value, 1) = "C" Then
If SDT.Cells(ZZ, SS).Value = "" Then
SDT.Cells(ZZ, SS).Value = .Cells(z, 2).Value
SS = SS + 1
For s = z To LS Step -1
If Left(NTB.Cells(s, 2).Value, 1) = "Z" Then
TL = Len(NTB.Cells(s, 2).Value) - 4
RL = TL
For LL = 4 To TL
SDT.Cells(ZZ, SS).Value = Left(NTB.Cells(s, 2).Value, RL)
RL = RL - 1
Next LL
End If
Next s
Else
ZZ = ZZ + 1
SDT.Cells(ZZ, SS).Value = .Cells(z, 2).Value
SS = SS + 1
For s = z To LS Step -1
If Left(NTB.Cells(s, 2).Value, 1) = "Z" Then
TL = Len(NTB.Cells(s, 2).Value) - 4
RL = TL
For LL = 3 To TL
SDT.Cells(ZZ, SS).Value = Left(NTB.Cells(s, 2).Value, RL)
RL = RL - 1
Next LL
End If
Next s
End If
End If
SS = 1
Next z
End With
Application.ScreenUpdating = True
End Sub
Mit Freundlichem Gruß
X