I have a code for a user form which has multi pages which is used to store data on a database. It is working perfectly before but now; when I try to click the submit button the code is running but not showing any results. I tried to check each code and also the spelling, but everything seems correct. Can you help me identify the error?
<code> Dim sh As Worksheet, msg As String, arr, c As Range, id, dataItem, schedule, i As Long
'check for any empty required fields
If Len(TextBox1.Value) = 0 Then msg = msg & vbLf & " - Employee ID"
If Len(msg) > 0 Then 'anything missing?
MsgBox "The following fields are required:" & msg, _
vbOKOnly + vbCritical, "Missing Information"
Else
'OK to write to sheet
Set sh = ThisWorkbook.Sheets("Bulk Loader File")
Set c = sh.Cells(Rows.Count, "A").End(xlUp).Offset(1) '##start adding here
arr = Split(TextBox1.Value, ",") '##split on comma to get an array
For i = 21 To 33 Step 2 '## loop over comboboxes
dataItem = Me.Controls("ComboBox" & i).Value '## read combo values...
schedule = Me.Controls("ComboBox" & (i + 1)).Value
If Len(dataItem) > 0 Then
For Each id In arr '##loop over the array
c.Resize(1, 30).Value = Array(Trim(id), TextBox2.Value, TextBox3.Value, TextBox4.Value, TextBox5.Value, TextBox6.Value, TextBox7.Value, TextBox8.Value, _
ComboBox7.Value, ComboBox8.Value, ComboBox9.Value, ComboBox10.Value, ComboBox11.Value, _
ComboBox12.Value, ComboBox13.Value, ComboBox14.Value, ComboBox15.Value, ComboBox16.Value, _
ComboBox17.Value, ComboBox1.Value, ComboBox2.Value, ComboBox3.Value, ComboBox4.Value, _
ComboBox5.Value, ComboBox6.Value, ComboBox18.Value, ComboBox19.Value, ComboBox20.Value, dataItem, schedule)
Set c = c.Offset(1) '##next output row
Next id
End If
Next i
MsgBox "Time Series Attributes Loaded", vbOKOnly + vbInformation, "Notification"
Unload Me
End If
End Sub
</code>
<code> Dim sh As Worksheet, msg As String, arr, c As Range, id, dataItem, schedule, i As Long
'check for any empty required fields
If Len(TextBox1.Value) = 0 Then msg = msg & vbLf & " - Employee ID"
If Len(msg) > 0 Then 'anything missing?
MsgBox "The following fields are required:" & msg, _
vbOKOnly + vbCritical, "Missing Information"
Else
'OK to write to sheet
Set sh = ThisWorkbook.Sheets("Bulk Loader File")
Set c = sh.Cells(Rows.Count, "A").End(xlUp).Offset(1) '##start adding here
arr = Split(TextBox1.Value, ",") '##split on comma to get an array
For i = 21 To 33 Step 2 '## loop over comboboxes
dataItem = Me.Controls("ComboBox" & i).Value '## read combo values...
schedule = Me.Controls("ComboBox" & (i + 1)).Value
If Len(dataItem) > 0 Then
For Each id In arr '##loop over the array
c.Resize(1, 30).Value = Array(Trim(id), TextBox2.Value, TextBox3.Value, TextBox4.Value, TextBox5.Value, TextBox6.Value, TextBox7.Value, TextBox8.Value, _
ComboBox7.Value, ComboBox8.Value, ComboBox9.Value, ComboBox10.Value, ComboBox11.Value, _
ComboBox12.Value, ComboBox13.Value, ComboBox14.Value, ComboBox15.Value, ComboBox16.Value, _
ComboBox17.Value, ComboBox1.Value, ComboBox2.Value, ComboBox3.Value, ComboBox4.Value, _
ComboBox5.Value, ComboBox6.Value, ComboBox18.Value, ComboBox19.Value, ComboBox20.Value, dataItem, schedule)
Set c = c.Offset(1) '##next output row
Next id
End If
Next i
MsgBox "Time Series Attributes Loaded", vbOKOnly + vbInformation, "Notification"
Unload Me
End If
End Sub
</code>
Dim sh As Worksheet, msg As String, arr, c As Range, id, dataItem, schedule, i As Long
'check for any empty required fields
If Len(TextBox1.Value) = 0 Then msg = msg & vbLf & " - Employee ID"
If Len(msg) > 0 Then 'anything missing?
MsgBox "The following fields are required:" & msg, _
vbOKOnly + vbCritical, "Missing Information"
Else
'OK to write to sheet
Set sh = ThisWorkbook.Sheets("Bulk Loader File")
Set c = sh.Cells(Rows.Count, "A").End(xlUp).Offset(1) '##start adding here
arr = Split(TextBox1.Value, ",") '##split on comma to get an array
For i = 21 To 33 Step 2 '## loop over comboboxes
dataItem = Me.Controls("ComboBox" & i).Value '## read combo values...
schedule = Me.Controls("ComboBox" & (i + 1)).Value
If Len(dataItem) > 0 Then
For Each id In arr '##loop over the array
c.Resize(1, 30).Value = Array(Trim(id), TextBox2.Value, TextBox3.Value, TextBox4.Value, TextBox5.Value, TextBox6.Value, TextBox7.Value, TextBox8.Value, _
ComboBox7.Value, ComboBox8.Value, ComboBox9.Value, ComboBox10.Value, ComboBox11.Value, _
ComboBox12.Value, ComboBox13.Value, ComboBox14.Value, ComboBox15.Value, ComboBox16.Value, _
ComboBox17.Value, ComboBox1.Value, ComboBox2.Value, ComboBox3.Value, ComboBox4.Value, _
ComboBox5.Value, ComboBox6.Value, ComboBox18.Value, ComboBox19.Value, ComboBox20.Value, dataItem, schedule)
Set c = c.Offset(1) '##next output row
Next id
End If
Next i
MsgBox "Time Series Attributes Loaded", vbOKOnly + vbInformation, "Notification"
Unload Me
End If
End Sub