Keep text viewable

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
What I am wanting to do is after a user enteres information in a text box, is the next time the user views the textbox the same information is in it. And the user will have the option of changing it if they like. This is what I have.

Private Sub txtCust_AfterUpdate()
Sheets("Customer").Range("C5").Value = TxtCust.Text
End Sub

Thx Dan
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Dan, there are at least 2 ways.

1. Use: Me.Hide when you close the Userform, this way it will remain in memory and retain ALL control values.

2. Use:

TxtCust.Text =Sheets("Customer").Range("C5").Value

In the Initialize Event of the UserForm.
 
Upvote 0
Thanks Alot Dave, Just a beginer here.Have a good evening and thx for your time. Dan
 
Upvote 0
Hi,

You can try the following:

Sub UserForm_Initialise()
If Trim(Sheets("Customer").Range("C5").Value) <> "" Then
TxtCust.Text = Sheets("Customer").Range("C5").Value
End If
End Sub

'This sub is to add the value to your textbox before it shows up.

Private Sub txtCust_AfterUpdate()
Q = MsgBox("Change value", vbOKCancel, "Warning")
If Q = vbYes Then
Sheets("Customer").Range("C5").Value = TxtCust.Text
End If
End Sub

Once the value in the textbox is changed, it will ask whether you want to change it or not.

HTH
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,288
Members
448,563
Latest member
MushtaqAli

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