MsgBox prompt to include TextBox4 value?

Big Lar

Well-known Member
Joined
May 19, 2002
Messages
552
Code:
If Trim(Me.TextBox4.Value) >= 7 Then<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
If MsgBox(Prompt:="Is #1 score correct?", Buttons:=vbYesNo) = vbNo Then<o:p></o:p>
Me.TextBox4.SetFocus<o:p></o:p>
Exit Sub<o:p></o:p>
Else<o:p></o:p>
End If<o:p></o:p>
End If
<o:p></o:p>
Is it possible for the MsgBox prompt to include TextBox4 value?
<o:p></o:p>
Example:
<o:p></o:p>
If TextBox4.Value equals 10,
<o:p></o:p>
MsgBox prompt equals “Is 10 correct for #1?”
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
If MsgBox(Prompt:="Is " & TextBox4.Value & " correct for #1?", Buttons:=vbYesNo + vbQuestion) = vbNo Then
 

bjurney

Active Member
Joined
Aug 24, 2009
Messages
320
I belive this is what you are looking for

Code:
If Trim(Me.TextBox4.Value) >= 7 Then
If MsgBox(Prompt:="Is " & Trim(Me.TextBox4.Value) & " correct for #1?", Buttons:=vbYesNo) = vbNo Then
Me.TextBox4.SetFocus
Exit Sub
Else
End If
End If
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Leave it to an MVP to beat me to it! :biggrin:

We do our best :)

Also, since Text Boxes store values as text (!) I think that you need

Code:
If Val(Trim(Me.TextBox4.Value)) >= 7 Then

to convert to a number.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,583
Messages
5,625,623
Members
416,124
Latest member
DeMoNloK

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top