【发布时间】:2019-04-08 17:45:31
【问题描述】:
我已经编写了一个代码来将表单数据传输到电子表格。它工作正常,但前几天晚上我开始对其进行更改,却没有意识到这是我的核心代码并且没有备份。 (很晚了)我不记得我改变了什么。现在它不会 100% 的时间传输表单数据,当它传输时,它的速度很慢。我的意思是......像 35 秒更新慢。任何人都可以提供有关如何改进和/或修复此问题的任何提示或帮助吗?任何帮助将不胜感激。
Sub CommandButton1_Click()
If ComboBox2.Value = "" Or ComboBox3.Value = "" Or ComboBox6.Value = "" Or ComboBox7.Value = "" Or ComboBox8.Value = "" Or ComboBox9.Value = "" Then
MsgBox ("The form is not complete")
Exit Sub
Else
End If
Workbooks("Language Line April AM - 2019.xlsm").Worksheets("2019 LL DB").Activate
Dim lastrow As Long, count As Long
lastrow = Sheet7.Cells(Rows.count, 1).End(xlUp).Row
lastrow = lastrow + 1
Cells(lastrow, 1) = ComboBox6.Value 'Tester
Cells(lastrow, 2) = TextBox4.Value 'Date
Cells(lastrow, 3) = TextBox5.Value 'Meridiem
Cells(lastrow, 4) = TextBox6.Value 'LOB
Cells(lastrow, 5) = TextBox7.Value 'Language
Cells(lastrow, 6) = ComboBox4.Value 'Phone Options
Cells(lastrow, 7) = ComboBox6.Value 'Representative
Cells(lastrow, 8) = TextBox4.Value 'Supervisor
Cells(lastrow, 9) = TextBox5.Value 'Manager
Cells(lastrow, 10) = TextBox6.Value 'Director
Cells(lastrow, 11) = TextBox7.Value 'Location
Cells(lastrow, 12) = ComboBox7.Value 'Whisper
Cells(lastrow, 13) = ComboBox8.Value 'UAD Indicator
Cells(lastrow, 14) = TextBox8.Value 'Results for system
Cells(lastrow, 15) = ComboBox9.Value 'Free Translator Offer
Cells(lastrow, 16) = TextBox9.Value 'Results for Rep offer
Cells(lastrow, 17) = TextBox12.Value 'Comments
ActiveWorkbook.Save
MsgBox "Entry has been logged!"
ComboBox2.Value = ""
ComboBox3.Clear
ComboBox4.Clear
ComboBox4.Value = ""
ComboBox5.Clear
ComboBox6.Value = ""
ComboBox7.Value = ""
ComboBox8.Value = ""
ComboBox9.Clear
TextBox12.Value = ""
CheckBox1.Value = False
TextBox4.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
TextBox9.Value = ""
TextBox13.Value = ""
结束子
【问题讨论】:
-
Else之后应该发生什么事情吗? -
没有。如果没有它,它就不允许我编译。另外,代码中有一个“End Sub”,我只是忘了放在这里。