PDA

View Full Version : Userform Input Saved To Different Workbook



Mooseman60
10-28-2010, 04:56 AM
Can someone give me the code for the following

I have a userform with 3 textboxes to add employee details ie: First Name, Surname, Hourly Rate which needs to be saved to a worksheet called EmployeeDetails in a separate workbook called Defined Name List.xls in a folder named Project Data

The file path is MyDir = "C\Users\Doug\Project Data\Defined Name List".

I was able to get it to save to the worksheet when it was in the same workbook but not sure how to get it to save in the separate workbook

Any help would be appreciated:banghead:

mikerickson
10-28-2010, 07:49 AM
Workbooks("otherBook.xls").Worksheets("someSheet").Range("A1").Value = TextBox1.Text

Mooseman60
10-29-2010, 01:59 AM
mikerickson

Where do I actual insert the code in the command button or in the text box code windw

mikerickson
10-29-2010, 06:52 AM
Currently your userforms correctly saves things to the workbook that contains the UF. That code would go in the same places that the current code does that function.

Its probably a matter of either replacing ThisWorkbook with a workbook variable or fully qualifying cell references in the existing code.

If you could post your current code or attach a redacted version of your workbook, that would help us find exactly how it should be tweeked.