wondering if there is a code to save the values/data in a UserForm so that the user can close the workbook and then open back up and complete at a later time?
Thanks!
wondering if there is a code to save the values/data in a UserForm so that the user can close the workbook and then open back up and complete at a later time?
Thanks!
You could add a button to write code to a temporary worksheet. On opening the userform, Initialize can check for its existence, and if found, write the values to the form and delete the temporary sheet.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
how would this be doneOriginally Posted by mdmackillop
You could also set the Tag property of any control with a value entered equal to that value and fill it back in when the form gets activated again.
Regards,
Brandtrock
Try this ...
Charlize
Here is a simple example that saves all of the controls in a form on closedown
[vba]
Private Sub UserForm_Terminate()
Dim oSaved As Worksheet
Dim oCtl As Control
Dim i As Long
On Error Resume Next
Set oSaved = Worksheets("SaveUF")
On Error GoTo 0
If oSaved Is Nothing Then
Worksheets.Add.Name = "SaveUF"
Set oSaved = Worksheets("SaveUF")
End If
oSaved.Cells.ClearContents
With Me
i = 1
For Each oCtl In .Controls
oSaved.Cells(i, "A").Value = oCtl.Name
On Error Resume Next
oSaved.Cells(i, "B").Value = oCtl.Caption
oSaved.Cells(i, "C").Value = oCtl.Value
On Error GoTo 0
i = i + 1
Next oCtl
End With
End Sub
[/vba]
Is there any reason that custom document properties couldn't be used for this?
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
No there isn't; as there is no reason Excel defined names COULDN'T; as there is no reason the registry COULDN'T; as there is no reason .ini files COULDN'T; as there is no reason text files COULDN'T; as there is no reason ...
They are all just receptacles for the information.