It was working all day. I don't see what I did wrong here, but the submit button does nothing anymore. I have multiple userforms in this sheet, but all of them have the same issue now.
Any help would be very much appreciated.
Any help would be very much appreciated.
VBA Code:
Option Explicit
Dim sh As Worksheet
Private Sub ComboBox1_Change()
Dim c As Range, dic As Object
Set dic = CreateObject("Scripting.Dictionary")
ComboBox2.Clear
ComboBox3.Clear
For Each c In sh.Range("A2", sh.Range("A" & Rows.Count).End(xlUp))
If c.Value = ComboBox1.Value Then
dic(c.Offset(0, 1).Value) = Empty
End If
Next
ComboBox2.List = dic.keys
End Sub
Private Sub ComboBox2_Change()
Dim c As Range, dic As Object
ComboBox3.Clear
For Each c In sh.Range("A2", sh.Range("A" & Rows.Count).End(xlUp))
If c.Value = ComboBox1.Value And c.Offset(0, 1).Value =
ComboBox2.Value Then
ComboBox3.AddItem c.Offset(, 2).Value
End If
Next
End Sub
Private Sub CommandButton1_Click()
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Value = ""
ComboBox2.Value = ""
ComboBox3.Value = ""
'ComboBox4.Value = ""
End Sub
Private Sub CommandButton2_Click()
Dim x As Long
Dim y As Worksheet
Set y = Sheet18
x = y.Range("A" & Rows.Count).End(xlUp).Row + 1
With y
.Cells(x, 1).Value = ComboBox1.Text
.Cells(x, 2).Value = ComboBox2.Text
.Cells(x, 3).Value = ComboBox3.Text
.Cells(x, 4).Value = ComboBox4.Text
.Cells(x, 5).Value = ComboBox5.Text
.Cells(x, 6).Value = TextBox2.Text
'.Cells(x, 8) = [Text(Now(), "DD-MM-YYYY HH:MM")]
End With
Unload Me
FWI3.Show
End Sub
Private Sub UserForm_Activate()
Dim c As Range, dic As Object
Set sh = Sheets("listf")
Set dic = CreateObject("Scripting.Dictionary")
For Each c In sh.Range("A2", sh.Range("A" & Rows.Count).End(xlUp))
dic(c.Value) = Empty
Next
ComboBox1.List = dic.keys
With ComboBox4
.AddItem "1"
.AddItem "2"
.AddItem "3"
.AddItem "4"
.AddItem "5"
End With
With ComboBox5
.AddItem "4:30"
.AddItem "4:00"
.AddItem "3:30"
.AddItem "2:30"
.AddItem "2:00"
.AddItem "1:30"
.AddItem "1:20"
.AddItem "1:00"
.AddItem "0:50"
.AddItem "0:45"
.AddItem "0:30"
End With
End Sub