Consulting

Results 1 to 4 of 4

Thread: Userform Input Saved To Different Workbook

  1. #1

    Userform Input Saved To Different Workbook

    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

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    Workbooks("otherBook.xls").Worksheets("someSheet").Range("A1").Value = TextBox1.Text

  3. #3
    mikerickson

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

  4. #4
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •