消息框确认数据更改操作

我有我的提交button代码是这样的:

Private Sub CommandButton1_Click() Sheets("Overall").Activate With Me If Len(.ComboBox1.Value) * Len(.TextBox1.Value) * Len(.ComboBox2.Value) * Len(.ComboBox3.Value) * Len(.TextBox2.Value) * Len(.TextBox3.Value) * Len(.ComboBox4.Value) * Len(.ComboBox5.Value) * Len(.TextBox4.Value) * Len(.TextBox5.Value) * Len(.TextBox6.Value) * Len(.ComboBox6.Value) * Len(.TextBox7.Value) * Len(.TextBox8.Value) = 0 Then MsgBox "Please Complete All Fields Before Submit" Else eRow = Sheet9.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row Cells(eRow, 1).Value = ComboBox1.Text Cells(eRow, 2).Value = TextBox2.Text Cells(eRow, 3).Value = TextBox3.Text Cells(eRow, 4).Value = TextBox1.Text Cells(eRow, 5).Value = ComboBox3.Text Cells(eRow, 6).Value = TextBox4.Text Cells(eRow, 7).Value = TextBox5.Text Cells(eRow, 8).Value = ComboBox4.Text Cells(eRow, 15).Value = ComboBox6.Text Cells(eRow, 10).Value = ComboBox5.Text Cells(eRow, 11).Value = TextBox7.Text Cells(eRow, 12).Value = TextBox8.Text Cells(eRow, 13).Value = TextBox6.Text Cells(eRow, 14).Value = ComboBox2.Text End If End With End Sub 

我想添加一个确认popup消息框来提醒用户,如果在TextBox8中键入的值超过了3.0

如果用户select“是”,那么只会将数据存储在Excel表格中,但如果用户select否,则会popup另一个popup消息框,通知用户重新inputTextBox8中的值。

我应该在哪里添加vbYesNo消息框?

Cells更改之前添加这样的内容:

 If TextBox8.Value > 3 Then If MsgBox("TextBox8 > 3" & vbCrLf & "Continue?", vbYesNo) = vbNo Then MsgBox "Please change the value of TextBox8" TextBox8.SetFocus Else '//eRow = ... End If End If 

它将显示一个YesNo MsgBox来要求用户继续。 如果用户select“ No ,则带有通知的第二个MsgBox将显示,然后文本框将被激活。