Results 1 to 4 of 4

VBA Code Takes too long to Run

Threaded View

  1. #1
    Registered User
    Join Date
    04-16-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    33

    VBA Code Takes too long to Run

    Hello Friends,
    I am Using this code to filter and copy date to one sheet to other sheet based on combobox Value in Excel, But it takes too long to run. I have Some conditional formatting in sheet.
    Please help to Optimize the code performance.

    sCust = Cmbsearch.Value
        Set rRng = Worksheets("Ledger").Range("A8:N2000")
        rRng.ClearContents
        nCRow = 7
        nIRow = 7
            Do While Len(Trim(Worksheets("DATA").Cells(nIRow, 1).Value)) > 0
            If Worksheets("DATA").Cells(nIRow, 1).Value = sCust Then
                nCRow = nCRow + 1
                'Worksheets("Ledger").Cells(nCRow, 1).Value = Worksheets("DATA").Cells(nIRow, 1).Value
                Worksheets("Ledger").Cells(nCRow, 2).Value = Worksheets("DATA").Cells(nIRow, 2).Value
                Worksheets("Ledger").Cells(nCRow, 3).Value = Worksheets("DATA").Cells(nIRow, 3).Value
                Worksheets("Ledger").Cells(nCRow, 4).Value = Worksheets("DATA").Cells(nIRow, 4).Value
                Worksheets("Ledger").Cells(nCRow, 5).Value = Worksheets("DATA").Cells(nIRow, 5).Value
                Worksheets("Ledger").Cells(nCRow, 6).Value = Worksheets("DATA").Cells(nIRow, 6).Value
                Worksheets("Ledger").Cells(nCRow, 7).Value = Worksheets("DATA").Cells(nIRow, 7).Value
                Worksheets("Ledger").Cells(nCRow, 8).Value = Worksheets("DATA").Cells(nIRow, 8).Value
                Worksheets("Ledger").Cells(nCRow, 9).Value = Worksheets("DATA").Cells(nIRow, 9).Value
                Worksheets("Ledger").Cells(nCRow, 10).Value = Worksheets("DATA").Cells(nIRow, 69).Value
                Worksheets("Ledger").Cells(nCRow, 11).Value = Worksheets("DATA").Cells(nIRow, 68).Value
                Worksheets("Ledger").Cells(nCRow, 12).Value = Worksheets("DATA").Cells(nIRow, 74).Value
                Worksheets("Ledger").Cells(nCRow, 13).Value = Worksheets("DATA").Cells(nIRow, 67).Value
                Worksheets("Ledger").Cells(nCRow, 14).Value = Worksheets("DATA").Cells(nIRow, 75).Value
    
            End If
            nIRow = nIRow + 1
            Loop
    End If
    Last edited by rain4uu; 06-04-2020 at 08:41 AM. Reason: Typing Mistake

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Code works, but takes far too long
    By DanzaNZ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2019, 01:33 AM
  2. [SOLVED] Help with code efficiency - routine takes WAY too long to run
    By robertsfd2002 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-24-2018, 07:37 PM
  3. [SOLVED] This code takes way to long to run
    By Jym396 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2017, 11:07 AM
  4. [SOLVED] Translate code takes long time
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2016, 12:58 AM
  5. Inefficient code - macro takes too long
    By dantray02 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-07-2014, 09:29 AM
  6. Long code takes an age to run
    By E3iron in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-05-2009, 07:38 AM
  7. My Code takes too long to execute
    By coreytroy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-30-2008, 12:12 AM

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