warehouse cell values disappear when the Userform is hide

gr8trthanu

Board Regular
Joined
Nov 14, 2008
Messages
103
Hello,

I have a userform where I enter customer information.

When I complete the text boxes on the userform I have a command button that should move the information to a worksheet and hide the userform so I can continue working on the worksheet.

IE: Worksheets("Costing_Estimate").Range("I12").Value = txtDate.Value

The migration of the data migrates to the cells no problem but when the userform disappears so does the data for customer information.

I have used the following code: unload / hide / visible and all data disappears!!

How can I hide/close the userform, keep the customer information on the worksheet so that I can continue working on the spreadsheet.

thanks a bunch~
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
What does this mean:
"How can I hide/close the userform, keep the customer information on the worksheet so that I can continue working on the spreadsheet.

Why do you use two different terms?
Worksheet and Spreadsheet.

Are you saying the date you enter into the UserForm is not being entered into the worksheet.

Show us your script.

You have a textbox on your UserForm named "txtDate" ??
 
Upvote 0
Hi "My Answer Is This"

Love the name.

I have a userform where the user will enter customer information.

Each textbox or listbox is linked to a cell on a worksheet.

When all the fields are filled out on the userform, the user should select the command button to move each text field data to it's respected cell and close/hide the form.

When the userform is closed or hidden the data disappears as well on the worksheet.

Here is my code....

Private Sub cmdSave_Click()
Worksheets("Costing_Estimate").Range("I12").Value = txtDate.Value
Worksheets("Costing_Estimate").Range("N12").Value = lbxPrepared.Value
Worksheets("Costing_Estimate").Range("D14").Value = txtProject.Value
Worksheets("Costing_Estimate").Range("I14").Value = txtCompany.Value
Worksheets("Costing_Estimate").Range("N14").Value = txtContact.Value
Worksheets("Costing_Estimate").Range("D16").Value = txtBusiness.Value
Worksheets("Costing_Estimate").Range("I16").Value = txtCell.Value
Worksheets("Costing_Estimate").Range("N16").Value = txtEmail.Value
Worksheets("Costing_Estimate").Range("I12").Value = txtDate.Value
Worksheets("Costing_Estimate").Range("D18").Value = txtStreet.Value
Worksheets("Costing_Estimate").Range("N18").Value = txtCity.Value
Worksheets("Costing_Estimate").Range("N20").Value = txtProvince.Value
Worksheets("Costing_Estimate").Range("N22").Value = lbxCountry.Value
ActiveWorkbook.Save
frmCustomerInfo.Hide
End Sub
 
Upvote 0
It helps when you answer our questions.

I asked: You have a textbox on your UserForm named "txtDate" ??

To start with I would take out this line of code which says "ActiveWorkbook.Save until you have this working.

How do you know the data is being transferred to the Worksheet and then disappears.
If it disappears how do you know it was ever put on the sheet.
And the name of your Userform is "frmCustomerInfo"

Is this the first time you have ever made a Userform?

When you unload the UserForm the form dumps all the dynamic values.
 
Upvote 0
Hi, thank you for being patient with me..

Yes I do have a text box entitled yet Date which captures today's date.

I removed the save code as you suggested.

I know that the data is being transferred to the worksheet because I see the data for a quick second until the form unloads. Once the form unloads all cells with their respected data disappears.

Yes this is the first time doing a user form and did some research prior to starting. Apparently I am missing something.

Thanks
 
Upvote 0
I have no answer for you. I have never heard of data just disappearing from a sheet unless you have more code in this UserForm then I can see here.

I would suggest making a new very simple UserForm and see what happens.
 
Upvote 0
Hi gr8trthanu,

Do you have some of the UserForm's controls properties set to link to the worksheet cells? For example, do you have the ControlSource property of the txtDate TextBox set to Costing_Estimate!I12?

If so, remove those dynamic links and instead use only code to read and write values between the UserForm and Worksheets.
 
Last edited:
Upvote 0
thank you gentlemen..
Is it possible that I email the file to be reviewed..I have tried all suggestions with no luck.
 
Upvote 0
Did you try sending the values to a different sheet?
Show us all the scripting in your UserForm
Did you try making a simple Userform
Put in one textbox
Then enter command button script like:
Activesheet.cells(1,1).value = texbox1.value

I always start out simple when doing new things like using UserForms until I understand the concepts.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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