Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Could some one please help. I am trying to create a user form that will
enter data into an Excel spreadsheet. I have managed to do this but I want 2 of the text boxes to remeber what was last entered into them. I have managed this if I hide the form but when I close the spreadsheet and reopen the form has now lost the information. What can I do to prevent this happening!!! -- Thanks Gilly |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Same concept as Chandra but if you're writing the entries in the textboxes
to a worksheet (and presumably saving it) then in the userform's initialize event you can write code to reverse the process. That is, write the cell contents to the textboxes. -- Jim "Gilly Hampshire" wrote in message ... | Could some one please help. I am trying to create a user form that will | enter data into an Excel spreadsheet. I have managed to do this but I want 2 | of the text boxes to remeber what was last entered into them. I have managed | this if I hide the form but when I close the spreadsheet and reopen the form | has now lost the information. What can I do to prevent this happening!!! | -- | Thanks | | Gilly |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Write the data to a hidden worksheet cell in the userform close event, and
restore it in the workbook_open, In the userform Private Sub UserForm_Terminate() With Worksheets("formdata") .Range("A1").Value = TextBox1.Text .Range("A2").Value = TextBox2.Text End With End Sub and in the Thisworkbook code module Private Sub Workbook_Open() With Worksheets("formdata") Load UserForm1 UserForm1.TextBox1.Text = .Range("A1").Value UserForm1.TextBox2.Text = .Range("A2").Value End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips "Gilly Hampshire" wrote in message ... Could some one please help. I am trying to create a user form that will enter data into an Excel spreadsheet. I have managed to do this but I want 2 of the text boxes to remeber what was last entered into them. I have managed this if I hide the form but when I close the spreadsheet and reopen the form has now lost the information. What can I do to prevent this happening!!! -- Thanks Gilly |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Essentially the same suggestion as several of the above - but how about
using a rangeless named range? Check the Excel help item titled "Creat a name to represent a formula or a constant" In your VBA code, you can store the value with something line Range("TxtBoxA").Value = me.TxtBoxA.Text and upon opening your form, you can retrieve it with me.TxtBoxA.Text = Range("TxtBoxA").Value Less chance of the casual user "helpfully" changing a worksheet cell for you... James Cox "Gilly Hampshire" wrote in message ... Could some one please help. I am trying to create a user form that will enter data into an Excel spreadsheet. I have managed to do this but I want 2 of the text boxes to remeber what was last entered into them. I have managed this if I hide the form but when I close the spreadsheet and reopen the form has now lost the information. What can I do to prevent this happening!!! -- Thanks Gilly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
New to User Forms | New Users to Excel | |||
User Forms | New Users to Excel | |||
user forms | Excel Discussion (Misc queries) | |||
User forms | Excel Programming | |||
User forms in VBA | Excel Programming |