Userform stopped entering data to the sheet when submitted.

ibruzzi

New Member
Joined
Jun 25, 2021
Messages
26
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
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.

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
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,214,666
Messages
6,120,806
Members
448,990
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top