[VBA ] 如何每按一下按鈕就換行
最近開始練習如何用VBA寫些小的介面
以方便記錄一些朋友指導教授所需的資訊
試問:如何按按鈕一次,row的數值就+1,已導致繼續換列輸入?
以下是我按鈕的寫法
Private Sub CommandButton1_Click()
row = 3
ActiveSheet.Cells(row, 1) = UserForm1.TextBox1.Text '取出品項
ActiveSheet.Cells(row, 2) = UserForm1.TextBox2.Text '取出發票號碼
ActiveSheet.Cells(row, 3) = UserForm1.TextBox3.Text '取出價格
ActiveSheet.Cells(row, 4) = UserForm1.ComboBox1.Text '取出品項的文字
If Cells(row, 4).Value <> "" And Cells(row, 3).Value <> "" And Cells(row,
2).Value <> "" And Cells(row, 1).Value <> "" _
Then row = row + 1: TextBox4.Text = row _
Else _
: MsgBox "請補足空白處" & Chr(13) & "請重新輸入", 16, "輸入錯誤1"
'TextBox4.Text = 0
End Sub
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.224.162.226
※ 文章網址: https://www.ptt.cc/bbs/Visual_Basic/M.1422265818.A.678.html
推
01/26 18:42, , 1F
01/26 18:42, 1F
→
01/26 18:44, , 2F
01/26 18:44, 2F
推
01/26 20:51, , 3F
01/26 20:51, 3F
→
01/26 20:52, , 4F
01/26 20:52, 4F
→
01/26 22:37, , 5F
01/26 22:37, 5F
→
01/26 22:38, , 6F
01/26 22:38, 6F
→
01/27 08:59, , 7F
01/27 08:59, 7F
→
01/27 10:26, , 8F
01/27 10:26, 8F
→
01/27 12:01, , 9F
01/27 12:01, 9F
→
01/27 12:02, , 10F
01/27 12:02, 10F
→
01/29 00:05, , 11F
01/29 00:05, 11F
→
01/29 00:07, , 12F
01/29 00:07, 12F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章