![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 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 |
|
|
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
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. |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
Thanks Alot Dave, Just a beginer here.Have a good evening and thx for your time. Dan
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Wellington
Posts: 104
|
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 |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
Thanks Tiger. Looks good , Have a good evening. Dan
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|