MsgBox to verify change of UserForm Textbox value?

9iron

New Member
Joined
May 29, 2011
Messages
5
When changing the value of TextBox3, I need to confirm the change with a message box with buttons (I think?)
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
“Do you want to change this value?”<o:p></o:p>
<o:p></o:p>
“Yes” allows the change and tabs to the next TextBox<o:p></o:p>
“No” prevents the change and tabs to the next TextBox.

Can Y'all help me do this?<o:p></o:p>
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Try like this

Code:
If MsgBox("Do you want to change this value?", vbQuestion + vbYesNo) = vbYes Then
    '
    'code to change value
    '
End If
TextBox4.SetFocus
 
Upvote 0
Thanks for the "towards" but,
I'm learning this stuff from scratch.

I don't know the code to change or keep the value in textbox3.
 
Upvote 0
You could use code like this:

Code:
Private Sub TextBox3_Enter()
    With TextBox3
        .Tag = .Text
    End With
End Sub

Private Sub TextBox3_AfterUpdate()
    With TextBox3
        If .Text <> .Tag Then
            If MsgBox("Verify change from " & .Tag & " to " & .Text, vbOKCancel) = vbCancel Then
                .Text = .Tag
            End If
        End If
    End With
End Sub
 
Upvote 0
Yippie!!!

After doing some study and messin around I finally figured out how to make it work.

Thanks for the code mikerickson!
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,843
Members
452,948
Latest member
UsmanAli786

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
Back
Top