+ Reply to Thread
Results 1 to 2 of 2

Transfer listbox values to new worksheet

  1. #1
    Registered User
    Join Date
    03-08-2010
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    6

    Transfer listbox values to new worksheet

    I know this should be simple but it's doing my head at he present.


    I need to copy all the list box values to a new worksheet for reporting purposes. I can move the values but there seems to be a huge calculting time before the code finishes. I just simply need need to transfer the list box values until the last row is complete. It may be something to do with the rowsource which can be quite extensive that causes the long calculating time


    This is the code I use :-

    Private Sub CommandButton3_Click()

    'saves listbox
    Dim lItem As Long

    'clear worksheet before saving
    Sheets("newreps").Cells.Clear

    For lItem = 0 To ListBox1.ListCount - 1
    With Worksheets("newreps")

    .Cells(lItem + 1, 1) = ListBox1.List(lItem, 0)
    .Cells(lItem + 1, 2) = ListBox1.List(lItem, 1)
    .Cells(lItem + 1, 3) = ListBox1.List(lItem, 2)
    .Cells(lItem + 1, 4) = ListBox1.List(lItem, 3)
    .Cells(lItem + 1, 5) = ListBox1.List(lItem, 4)

    End With

    Next lItem

    MsgBox ("Transfer complete")


    End Sub

    Many thanks

    Dave

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Transfer listbox values to new worksheet

    Does this work any faster?
    Please Login or Register  to view this content.
    Last edited by Norie; 02-03-2015 at 06:51 PM.
    If posting code please use code tags, see here.

+ 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. auto transfer specific values to new worksheet?
    By fearziz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2014, 12:12 PM
  2. [SOLVED] VBA: transfer values of textboxes & items from listbox to worksheet
    By hydz1213 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-19-2013, 05:46 AM
  3. Transfer the values from cells in one worksheet to another worksheet
    By Nett in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-08-2009, 12:48 PM
  4. commond button transfer values to new worksheet
    By brillison in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-26-2008, 09:51 AM
  5. userform listbox cannot get listbox.value to transfer back to main sub
    By malosky2@msn.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2006, 04:50 PM

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