Results 1 to 13 of 13

V Lookup Loop taking ages to run

Threaded View

  1. #1
    Registered User
    Join Date
    06-23-2020
    Location
    India
    MS-Off Ver
    2010
    Posts
    25

    V Lookup Loop taking ages to run

    Hi,

    I've been trying to run a code which has data for approx. 35,000 rows and there is a v-lookup loop which is giving the correct results. But the challenge is, this specific module takes more than an hour (1.5 hrs) to run. Is there a way to make the code more efficient?

    What I need: Col. N gets updated in CMDB_Raw Data sheet.

    How: Col. A of Raw Data sheet looked up in sheet- "Master List Asset Categorization" and a matching value from Col. B is populated in Col. N of raw data sheet

    Attaching the file. Also, here is my code:

    [CODE]Sub Categorization()

    Dim lastRow As Long, k As Long, wbk As Workbook, main_wbk As Workbook, lastrow1 As Long, range As range
    Dim main_sht As Worksheet, Sheet1 As Worksheet, sht1 As Worksheet, sepr As String

    Set main_wbk = Workbooks("CMDB_Production_File.xlsb")
    Set main_sht = main_wbk.Sheets("CMDB - Raw Data")

    main_wbk.Activate

    lastRow = main_wbk.Sheets("Master List Asset Categorzation").range("a1").End(xlDown).Row

    k = 2

    Do While main_sht.Cells(k, 1).Value <> ""

    On Error Resume Next

    main_sht.Cells(k, 14).Value = WorksheetFunction.VLookup(main_sht.Cells(k, 8).Value, _
    Sheets("Master List Asset Categorzation").range("a1:b" & lastRow), 2, 0)

    k = k + 1

    Loop

    MsgBox ("Press Categorization button")

    End Sub
    [CODE]
    Attached Files Attached Files
    Last edited by ruchikasharma9727; 06-24-2020 at 04:11 AM. Reason: Adding file and code

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Do While Loop taking too long
    By theTaoJones in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-08-2019, 11:18 AM
  2. [SOLVED] For Each loop taking long to run
    By Jay S. in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-07-2018, 01:08 PM
  3. Excel 2007 : Converting text to number is taking ages
    By Ruedebeuk in forum Excel General
    Replies: 18
    Last Post: 07-17-2018, 12:14 PM
  4. Cell calcs taking AGES on pactice World Cup spreadsheet
    By ExcelShadow in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-06-2014, 01:44 PM
  5. Help! lookup and datedif formula with ages and times
    By nt91 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-17-2012, 11:32 AM
  6. Loop taking much longer - looking for alternate options
    By b2b2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-15-2012, 12:29 PM
  7. Taking age group Ie ages 20-29 and picking out net sales for group
    By viabello in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-24-2006, 11:25 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