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
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 Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
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.
- I click the control button in workbook A to open my userform.
- I navigate to Workbook B and select/copy the needed cells.
- 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:
Thanks for your help!Code:Private Sub BTNpaste_Click() Dim cbUPCs As String If LBmyGroups.ListIndex <> -1 Then cbUPCs = ParseData TBupcs.Text = cbUPCs End If End Sub Function ParseData() As String Dim objData As MSForms.DataObject Dim varData, strData As String Set objData = New MSForms.DataObject On Error Resume Next objData.GetFromClipboard ParseData = objData.GetText End Function
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.
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 Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
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.
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks