Array transponieren
24.11.2008 17:24:00
Michael
ich hab mal wieder ein Brett vorm Kopf. In folgendem Macro fülle ich eine ListBox in einer UserForm mit einem dynamischen Array. Das klappt auch so weit , bis auf den einen FAll wo auf Grun der Werte das Array nur eindimensional ist. KAnn mir das einer erkären ?
Private Sub cmdOutput_Click()
Dim position1 As Long
Dim arrLieferung() As Variant
Dim arrTemp() As Variant
Dim arrOutput() As Variant
Zähler = 1
Textzeile1 = usfAnlegenLieferung.txtDocument.Value
If Right(Textzeile1, 1) "," Then Textzeile1 = Textzeile1 & ","
intStart1 = 1
Do
If InStr(intStart1, Textzeile1, ",") > 0 Then
position1 = InStr(1, Textzeile1, ",")
If Left(Textzeile1, position1 - 1) "" Then string1 = Left(Textzeile1, position1 - 1) Else _
string1 = ""
Textzeile1 = Right(Textzeile1, Len(Textzeile1) - position1)
intStart1 = InStr(1, Textzeile1, ",")
End If
usfOutputDevice.lblOutputDevice.Caption = "Druckparameter fur Dokument " & string1 & " angeben!" _
usfOutputDevice.Show
DoEvents
ReDim Preserve arrOutput(5, 1 To Zähler)
arrOutput(0, Zähler) = string1
arrOutput(1, Zähler) = usfOutputDevice.txtOutputDevice.Value
arrOutput(2, Zähler) = usfOutputDevice.txtAnzahl.Value
If usfOutputDevice.ckbPrint.Value = True Then arrOutput(3, Zähler) = "X" Else arrOutput(3, Zä _
hler) = " "
If usfOutputDevice.optPrint.Value = True Then arrOutput(4, Zähler) = "1" Else If _
usfOutputDevice.optArchive.Value = True Then arrOutput(4, Zähler) = "2" Else If usfOutputDevice.optPrintArchive.Value = True Then arrOutput(4, Zähler) = "3"
Zähler = Zähler + 1
Loop Until intStart1 = 0
With usfAnlegenLieferung.lbOutput
.ColumnCount = 5
.ColumnHeads = True
.List = Application.WorksheetFunction.Transpose(arrOutput)
.MultiSelect = fmMultiSelectMulti
End With
DoEvents
End Sub