Results 1 to 10 of 20

Thread: Speed Up ListBox Getting Updated Filled Very Slow

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Try this then

    Code:
    .Cells(Rx1, 3).Resize(,6).Value = var
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #2
    Junior Member
    Join Date
    Oct 2012
    Posts
    26
    Rep Power
    0
    Great works FAST :D

    Last question... what do i need to change when working with multitabs and multiple listboxes. I tried to use the code below.

    Code:
    Private Sub CommandButton2_Click()
        Dim var(3 To 8) As String
        Dim j As Long
        Dim x As Long
    
        If Me.ListBox2.ListIndex = -1 Then
            MsgBox "No Data Selected"
            Exit Sub
        End If
    
        If Me.TextBox2.Value = "" Then Exit Sub
    
        Rx2 = Rx2 + Me.ListBox1.ListIndex    'row index
        With Sheets("INPUT BS LISTBOX")
            For j = 3 To 8
                 var(j) = Me.Controls("TextBox" & j + 8).Text 'Starts in Textbox 9
        Next j
                .Cells(Rx2, 3).Resize(, 6).Value = var
        End With
        Call UserForm_Initialize
    End Sub

  3. #3
    Junior Member
    Join Date
    Oct 2012
    Posts
    26
    Rep Power
    0
    Got a question about the code i used couple of days. When i typed for example 3 in my textbox and i pushed on update it showed automatically 3% but with the new code it does not take over the cell property's how can.

    OLD CODE (fills cell format e.g. 3 will be automatically 3%)
    Code:
    Private Sub CommandButton2_Click()
        Dim j As Long
        Dim x As Long
    
        If Me.ListBox1.ListIndex = -1 Then
            MsgBox "No Data Selected"
            Exit Sub
        End If
        If Me.TextBox1.Value = "" Then Exit Sub
        Rx1 = Rx1 + Me.ListBox1.ListIndex   
        With Sheets("INPUT WV LISTBOX")
            For j = 8 To 10 
                .Cells(Rx1, j).Value = Me.Controls("TextBox" & j - 3).Text
            Next j
        End With
        Call UserForm_Initialize
    End Sub
    NEW CODE FAST (but puts only the value in the box e.g. 3 stays 3.)
    Code:
    rivate Sub CommandButton2_Click()
        Dim var(3 To 8) As String
        Dim j As Long
        Dim x As Long
    
        If Me.ListBox1.ListIndex = -1 Then
            MsgBox "No Data Selected"
            Exit Sub
        End If
        If Me.TextBox1.Value = "" Then Exit Sub
        Rx1 = Rx1 + Me.ListBox1.ListIndex
        With Sheets("INPUT WV LISTBOX")
            For j = 3 To 8
            var(j) = Me.Controls("TextBox" & j).Text
            Next j
            .Cells(Rx1, 3).Resize(, 6).Value = var
        End With
        Call UserForm_Initialize
    End Sub
    Last edited by Tony; 02-09-2013 at 01:04 AM.

Similar Threads

  1. Speed up excel to word VBA
    By bcostin in forum Excel Help
    Replies: 3
    Last Post: 05-22-2012, 10:49 AM
  2. Get the last updated file name.
    By princ_wns in forum Excel Help
    Replies: 3
    Last Post: 04-12-2012, 07:59 AM
  3. Speed up Loop VBA
    By PcMax in forum Excel Help
    Replies: 15
    Last Post: 04-09-2012, 04:20 PM
  4. Get last Filled Cell address in a Range.
    By Rajan_Verma in forum Rajan Verma's Corner
    Replies: 3
    Last Post: 03-24-2012, 01:08 AM
  5. Last Filled Cell Having Text
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 5
    Last Post: 07-18-2011, 02:33 PM

Posting Permissions

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