+ Reply to Thread
Results 1 to 4 of 4

Copy Multicolumn ListBox to Clipboard while keeping column formatting

  1. #1
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    365(PC) V:2308
    Posts
    1,473

    Copy Multicolumn ListBox to Clipboard while keeping column formatting

    Does anyone know how to copy a multicolumn ListBox to the clipboard so that when i paste, it will be in separate columns vs all data in one column?
    ex:
    Please Login or Register  to view this content.
    When I copy to the clipboard right now and then paste the above data concatenates into 1 cell as shown below.
    Please Login or Register  to view this content.
    I would want the vba to copy to the clipboard so that it will paste into the 4 separate columns as shown below:
    Please Login or Register  to view this content.

    Below is the current code i have found that is copying from my Listbox on a Userform to the clipboard:
    The name of my Multicolumn ListBox is ResultLB

    Please Login or Register  to view this content.

  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 Multicolumn ListBox to Clipboard while keeping column formatting

    Hello Dosydos,

    The DataObject only copies text to the clipboard, no formatting is included. You can easily transfer the data from the ListBox to a worksheet without using the clipboard. In your macro, you can then add in any formatting you like.
    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
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    365(PC) V:2308
    Posts
    1,473

    Re: Copy Multicolumn ListBox to Clipboard while keeping column formatting

    unfortunately the data will be pasted to a separate workbook where the location is always changing and completely random, so there is no way to know where to map the location too. This is why i need the data to stay in columns when sent to the clipboard so that i can manually paste where necessary. I have a feeling that there isn't going to be a solution for this project while continuing to use userform Listboxes.

  4. #4
    Forum Expert dosydos's Avatar
    Join Date
    12-09-2015
    Location
    Massachusetts
    MS-Off Ver
    365(PC) V:2308
    Posts
    1,473

    Re: Copy Multicolumn ListBox to Clipboard while keeping column formatting

    Update:
    I just figured out how to do this correctly.
    I need to add a "Tab" to my listbox while sending it to the clipboard. This way when i pasted the information it correctly understood where the columns were. Before i was stupidly using "SPACE". Correct code is below
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy-paste a row based on a column range value keeping the formatting and size.
    By nadgobb in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-16-2019, 09:36 AM
  2. [SOLVED] Copy listbox contents to clipboard
    By darbar76528 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2017, 04:06 PM
  3. ListBox Single Column Copy to Clipboard
    By Bharat.Nanwani in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2014, 05:58 PM
  4. Multicolumn Listbox - How to remove duplicates and sort by first column?
    By s2jrchoi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2013, 02:30 PM
  5. Having problems populating a multicolumn listbox changing Listbox column with a loop.
    By Aristizabal95 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2013, 12:41 PM
  6. Copy Selected items from multicolumn, multiselect listbox to another listbox
    By Willigb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 11:27 AM
  7. Doubleclick in a multicolumn listbox and get the column index?
    By peter233 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2008, 06:31 AM

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