Ich habe in einer UF eine Combobox "ComboBoxDatum" die ich mit den Datümer von Sheets "Schicht AF" A2:A367 fülle.
Nun wäre es super wenn ich die UF aufrufe,das mir die ComboBoxDatum gleich mit den Datum vom vortag gefüllt wird.
Hätte jemand eine Idee dazu?
Danke Heinz
Option Explicit
Private Sub ComboBoxDatum_Change()
Zeile = ComboBoxDatum.ListIndex + 2
ComboBoxSchicht.ListIndex = -1
ComboBoxSchicht.Enabled = IIf(ComboBoxDatum.ListIndex > -1, 1, 0)
End Sub
Private Sub ComboBoxSchicht_Change()
Spalte = ComboBoxSchicht.ListIndex + 1
Select Case Spalte
Case Is = 1
Spalte = 3 '+4
Case Is = 2
Spalte = 6 '+7
Case Is = 3
Spalte = 9 '+10
End Select
With Tabelle4
If Zeile > 0 And Spalte > 0 Then
TextBox2 = .Cells(Zeile, Spalte)
TextBox3 = .Cells(Zeile, Spalte + 1)
Else
TextBox2 = ""
TextBox3 = ""
End If
End With
End Sub
Private Sub Textbox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57
Case Else: KeyAscii = 0
End Select
End Sub
Private Sub UserForm_Initialize()
Dim MyArray As Variant
Dim lIndx As Long
Dim oDic As Object
Dim lIndxA As Long ' For/Next Index - außen
Dim lIndxI As Long ' For/Next Index - innen
Dim sTemp As String ' temporärer Zwischenspeicher
' hier wird die ComboBoxDatum befüllt
With ThisWorkbook.Worksheets("Schicht AF") ' den Tabellenblattnamen ggf. anpassen!
MyArray = .Range("A2:A" & .Cells(.Rows.Count, 1).End(xlUp).Row)
End With
Set oDic = CreateObject("Scripting.Dictionary")
For lIndx = 1 To UBound(MyArray)
If MyArray(lIndx, 1) "" Then
oDic(MyArray(lIndx, 1)) = 0
End If
Next lIndx
With ComboBoxDatum
.Style = 2
.List = Application.Transpose(oDic.keys)
End With
ComboBoxSchicht.AddItem 1
ComboBoxSchicht.AddItem 2
ComboBoxSchicht.AddItem 3
End Sub