最近開始練習如何用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