標題:
控制鈕輸入後換列在輸入?
[打印本頁]
作者:
john711101
時間:
2015-2-13 15:20
標題:
控制鈕輸入後換列在輸入?
如圖請問我用控制鈕輸入在第3列後如何讓他跳下一列在第4,5,6,7,8..........列繼續輸入?
感謝回答!
作者:
john711101
時間:
2015-2-13 15:23
程式是這樣
Private Sub Cm1_Click()
Sheets("BOB").Range("L3").Value = TextBox1.Value
Sheets("BOB").Range("B3").Value = TB3.Value
Sheets("BOB").Range("H3").Value = TB4.Value
Sheets("BOB").Range("N3").Value = TB5.Value
ActiveCell.Offset(1, 0).Select
TB3.Value = ""
TB4.Value = ""
TB5.Value = ""
TextBox1.Value = ""
End Sub
作者:
lpk187
時間:
2015-2-13 16:26
本帖最後由 lpk187 於 2015-2-13 16:28 編輯
BOBend = Sheets("BOB").Columns("L").Find("*", , , , , xlPrevious)
Sheets("BOB").Cells(BOBend + 1, "L") = TextBox1.Value
Sheets("BOB").Cells(BOBend + 1, "B") = TB3.Value
Sheets("BOB").Cells(BOBend + 1, "H") = TB4.Value
Sheets("BOB").Cells(BOBend + 1, "N") = TB5.Value
ActiveCell.Offset(1, 0).Select
TB3.Value = ""
TB4.Value = ""
TB5.Value = ""
TextBox1.Value = ""
作者:
lpk187
時間:
2015-2-13 16:30
少打了一個字,這個才對
BOBend = Sheets("BOB").Columns("L").Find("*", , , , , xlPrevious).Row
Sheets("BOB").Cells(BOBend + 1, "L") = TextBox1.Value
Sheets("BOB").Cells(BOBend + 1, "B") = TB3.Value
Sheets("BOB").Cells(BOBend + 1, "H") = TB4.Value
Sheets("BOB").Cells(BOBend + 1, "N") = TB5.Value
ActiveCell.Offset(1, 0).Select
TB3.Value = ""
TB4.Value = ""
TB5.Value = ""
TextBox1.Value = ""
作者:
lpk187
時間:
2015-2-13 16:49
BOBend = Sheets("BOB").Columns("L").Find("*", , , , , xlPrevious).Row '這行是會去找 L 欄的最後有文字的儲存格的那一列,前題是要這格每次都會輸入東西進去,若不會的話就換每次都會輸入進去的那一欄
作者:
changxxx
時間:
2015-2-14 09:53
試試+1
Private Sub CommandButton1_Click()
x = Sheets("BOB").[B65536].End(xlUp).Row + 1
Cells(x, 2) = TextBox1.Text
Cells(x, 3) = TextBox2.Text
Cells(x, 4) = TextBox3.Text
Cells(x, 5) = TextBox4.Text
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox1.SetFocus
End Sub
複製代碼
作者:
john711101
時間:
2015-2-14 10:57
感謝lpk187大跟changxxx大!
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)