Userform stopped entering data to the sheet when submitted.

ibruzzi

New Member
Joined
Jun 25, 2021
Messages
25
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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,147,518
Messages
5,741,634
Members
423,674
Latest member
Charles2dodo

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
Top