+ Reply to Thread
Results 1 to 6 of 6

Copy/Paste from worksheet to textbox in userform

  1. #1
    Registered User
    Join Date
    07-06-2009
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    7

    Question Copy/Paste from worksheet to textbox in userform

    Hello,
    I have created a userform with a listbox and a textbox. The listbox lists the names of all the ListObjects on the active worksheet. When one is selected, the listObject's contents are displayed in the textbox for editing. I need to be able to copy single columns of numbers from other workbooks and paste them into the textbox in my userform. This is difficult, as all other workbooks are locked out when the userform is displayed, and even if I copy the cells before displaying the userform, the cells seem to get dropped from the clipboard before I can hit the "paste" button that I added to the form. Any ideas?

    Thanks,
    Jarrod

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Copy/Paste from worksheet to textbox in userform

    Hello Jarrod,

    Welcome to the Forum!

    The default mode setting for a UserForm is Modal. That means it prevents the user from interacting with the application that owns the UserForm. In this case, the application is Excel.

    Display your UserForm in the Visual Basic Editor. In the Properties window, look for the property ShowModal. Change this from True to False. When your macro runs, you will be able to switch back and forth between workbooks and the UserForm.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    07-06-2009
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    7

    Smile Re: Copy/Paste from worksheet to textbox in userform

    Brilliant! I knew it had to be something simple I was overlooking. Thank you so much.

    This solves half the problem. The other half remains.
    1. I click the control button in workbook A to open my userform.
    2. I navigate to Workbook B and select/copy the needed cells.
    3. When I go back to workbook A and click the "Paste" button I added to the form, nothing happens. It works if I keep workbook B active and click "Paste." What gives? Here's the code for the pasting process:

    Please Login or Register  to view this content.
    Thanks for your help!

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Copy/Paste from worksheet to textbox in userform

    Hello Jarrod,

    You don't need to use Copy and Paste. VBA can transfer the data from one workbook to another for you. It would be easier to help you do this if you can post your workbook.

  5. #5
    Registered User
    Join Date
    07-06-2009
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Copy/Paste from worksheet to textbox in userform

    Unfortunately, due to the nature of the work, I can't post the workbook here.

    The reason I chose to utilize cut and paste is that the user won't necessarily be choosing *all* of the numbers from the secondary workbook, and they might be pulling numbers from several different workbooks.

  6. #6
    Registered User
    Join Date
    07-06-2009
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    7

    Red face Re: Copy/Paste from worksheet to textbox in userform

    Unfortunately, due to the nature of the work, I can't post the workbook here.

    The reason I chose to utilize cut and paste is that the user won't necessarily be choosing *all* of the numbers from the secondary workbook, and they might be pulling numbers from several different workbooks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1