いつもお世話になります
Windows7 excell2010 です
ご指導を仰ぎたいのは参照図で言うと、
TextBox1~6 は順調に入力しますがTextBox7にすると「入力」に飛び
参照図のG13に入力されません。
VBAを勉強し始めたはかりですのでどこが悪いかわかりません。
恐れ入りますがご指導願えませんでしょうか。
下記参考にします。
Module のコードには
Sub FormSample()
Do
UserForm1.Show
Loop
End Sub
Sub Test()
MsgBox "ボタンによるマクロの実行"
End Sub
UserForm1
Private Sub CommandButton1_Click()
n = 1
Do
n = n + 1
Loop While Cells(n, 1) <> ""
Cells(n, 1) = UserForm1.TextBox1.Text
Cells(n, 2) = UserForm1.TextBox2.Text
Cells(n, 3) = UserForm1.TextBox3.Text
Cells(n, 4) = UserForm1.TextBox4.Text
Cells(n, 5) = UserForm1.TextBox5.Text
Cells(n, 6) = UserForm1.TextBox6.Text
Cells(n, 7) = UserForm1.TextBox7.Text
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End
End Sub
TextBox1 = TabIndex 0
TextBox2 = TabIndex1
という具合に修正したらうまくゆきました。
例えば
Sub FormSample()
UserForm1.Show
If MsgBox("続行しますか?", vbYesNo) = vbNo Then
Exit Sub
Else
FormSample
End If
End Sub
なので、別案。
n = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(n, 1) = UserForm1.TextBox1.Text
(以下省略)
も採用させていただきました。
丁寧なご回答をいただき誠にありがとうございます。
お礼
TextBox1 = TabIndex 0 TextBox2 = TabIndex1 という具合に修正したらうまくゆきました。 例えば Sub FormSample() UserForm1.Show If MsgBox("続行しますか?", vbYesNo) = vbNo Then Exit Sub Else FormSample End If End Sub なので、別案。 n = Cells(Rows.Count, 1).End(xlUp).Row + 1 Cells(n, 1) = UserForm1.TextBox1.Text (以下省略) も採用させていただきました。 丁寧なご回答をいただき誠にありがとうございます。