Ich habe ein Userform mit mehreren Combo und Textboxen deren Inhalt per Commandbutton in bestimmte Zellen geschrieben wird.
Combobox6 ist 2 spaltig und wird befüllt mit: RowSource: G3:H34
Die linke Spalte wird aber nicht angezeigt: ColumnWidths: 0 PT;135PT
Allerdings möchte ich, das per Commandbutton nur der linke Wert (also der nicht sichtbare) der Combobox6 in die Zelle geschrieben wird.
Wie müsste der Code geändert werden? Bin in VBA nicht so bewandert.
Private Sub CommandButton1_Click()
Sheets("Abholung").Activate
Dim Zeile As Long, objControl As Control, intI As Integer, wks As Worksheet
Zeile = 21
Set wks = ActiveSheet
wks.Range("B22:B43").ClearContents
For intI = 7 To 21
Set objControl = Me.Controls("Combobox" & Format(intI, "0"))
If objControl.Text "" Then
Zeile = Zeile + 1
wks.Cells(Zeile, 2) = objControl.Text
End If
Next
For intI = 6 To 10
Set objControl = Me.Controls("Textbox" & Format(intI, "0"))
If objControl.Text "" Then
Zeile = Zeile + 1
wks.Cells(Zeile, 2) = objControl.Text
End If
Next
Range("C11") = ComboBox1.Text
Range("F11") = ComboBox2.Text
Range("G11") = ComboBox3.Text
Range("H11") = ComboBox4.Text
Range("F13") = ComboBox6.Text
Range("B14").Value = Me.TextBox1.Text
Range("B20").Value = Me.TextBox2.Text
Range("B16").Value = Me.TextBox3.Text & " " & Me.TextBox4.Text
Range("F16") = ComboBox5.Text
Range("B18").Value = Me.TextBox5.Text
Range("B46").Value = Me.TextBox11.Text
End Sub
Danke fürs lesen und die Hilfe!mfg, Andreas