|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 wangluor 于 2013-1-1 13:09 编辑
各位老师,这是一段录入信息窗口的vba窗体代码。小弟想请教如何让窗体按了确认键后自动循环至“TextBox1"处等待下次的录入信息。而不是手动选择“TextBox1”
Private Sub CommandButton1_Click()
Dim a As Long, s As Long, d As Long
a = Sheet1.Range("B65535").End(xlUp).Row + 1
s = Sheet1.Range("B65535").End(xlUp).Row + 2
d = Sheet1.Range("B65535").End(xlUp).Row + 3
Sheet1.Cells(a, "B") = TextBox1.Value
Sheet1.Cells(s, "B") = TextBox10.Value
Sheet1.Cells(d, "B") = TextBox11.Value
Sheet1.Cells(a, "C") = TextBox2.Value
Sheet1.Cells(s, "C") = TextBox2.Value
Sheet1.Cells(d, "C") = TextBox2.Value
Sheet1.Cells(a, "D") = TextBox3.Value
Sheet1.Cells(s, "D") = TextBox3.Value
Sheet1.Cells(d, "D") = TextBox3.Value
Sheet1.Cells(a, "E") = TextBox4.Value
Sheet1.Cells(a, "F") = TextBox5.Value
Sheet1.Cells(a, "G") = TextBox6.Value
Sheet1.Cells(a, "H") = TextBox7.Value
Sheet1.Cells(a, "I") = TextBox8.Value
Sheet1.Cells(a, "J") = TextBox9.Value
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
TextBox6.Value = ""
TextBox7.Value = ""
TextBox8.Value = ""
TextBox9.Value = ""
TextBox10.Value = ""
TextBox11.Value = ""
End Sub
|
|