LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Lookup Code

Hello All,

I'm wondering if anyone can help me out with the code below. When i
run it it takes very very long time to run. i would appreicate your
help. The data size is very large with multiple sheets but same
workbook (more than 50k rows and over 24 clos.)


'***Declarations
Dim iRowPlan As Integer
Dim iRowLTable As Integer
Dim iLastRowPlan As Integer
Dim iLastRowTable As Integer



' Select the lookup table (LTABLE)Worksheet
Sub Vlkup()
Sheets("LTABLE").Select

iLastRowTable = Cells.Find("*", , xlFormulas, , xlRows,
xlPrevious).Row

' Select the worksheet containing the Plan(PLAN)
Sheets("PLAN").Select
' Find the number of Planrecords and store it in iLastRow
iLastRowPlan = Cells.Find("*", , xlFormulas, , xlRows, xlPrevious).Row



' Loop through the Plantable and compare each record with Plan in the
lookup table
' If a match is found, change the Plantable with what is in the lookup
table
For iRowPlan = 6 To iLastRowPlan
For iRowLTable = 2 To iLastRowTable
If Sheets("PLAN").Cells(iRowPlan, 1) =
Sheets("LTABLE").Cells(iRowLTable, 1) _
Then
Sheets("EssPlan").Cells(iRowPlan, 1) =
Sheets("LTABLE").Cells(iRowPlan, 2)
Sheets("EssPlan").Cells(iRowPlan, 2) =
Sheets("LTABLE").Cells(iRowLTable, 3)
Sheets("EssPlan").Cells(iRowPlan, 3) =
Sheets("LTABLE").Cells(iRowLTable, 4)
Sheets("EssPlan").Cells(iRowPlan, 4) =
Sheets("LTABLE").Cells(iRowLTable, 5)
Sheets("EssPlan").Cells(iRowPlan, 5) =
Sheets("LTABLE").Cells(iRowLTable, 6)
Sheets("EssPlan").Cells(iRowPlan, 6) =
Sheets("LTABLE").Cells(iRowLTable, 7)
Sheets("EssPlan").Cells(iRowPlan, 7) =
Sheets("LTABLE").Cell(iRowLTable, 8)
Sheets("EssPlan").Cells(iRowPlan, 8) =
Sheets("Plan").Cells(iRowPlan, 11)
Sheets("EssPlan").Cells(iRowPlan, 9) =
Sheets("Plan").Cells(iRowPlan, 12)
Sheets("EssPlan").Cells(iRowPlan, 10) =
Sheets("Plan").Cells(iRowPlan, 13)
Sheets("EssPlan").Cells(iRowPlan, 11) =
Sheets("Plan").Cells(iRowPlan, 14)
Sheets("EssPlan").Cells(iRowPlan, 12) =
Sheets("Plan").Cells(iRowPlan, 15)
Sheets("EssPlan").Cells(iRowPlan, 13) =
Sheets("Plan").Cells(iRowPlan, 16)
Sheets("EssPlan").Cells(iRowPlan, 14) =
Sheets("Plan").Cells(iRowPlan, 12)
Sheets("EssPlan").Cells(iRowPlan, 15) =
Sheets("Plan").Cells(iRowPlan, 13)
Sheets("EssPlan").Cells(iRowPlan, 16) =
Sheets("Plan").Cells(iRowPlan, 14)
Sheets("EssPlan").Cells(iRowPlan, 17) =
Sheets("Plan").Cells(iRowPlan, 15)
Sheets("EssPlan").Cells(iRowPlan, 18) =
Sheets("Plan").Cells(iRowPlan, 16)
Sheets("EssPlan").Cells(iRowPlan, 19) =
Sheets("Plan").Cells(iRowPlan, 17)
Sheets("EssPlan").Cells(iRowPlan, 20) =
Sheets("Plan").Cells(iRowPlan, 18)
Sheets("EssPlan").Cells(iRowPlan, 21) =
Sheets("Plan").Cells(iRowPlan, 19)
Sheets("EssPlan").Cells(iRowPlan, 23) =
Sheets("Plan").Cells(iRowPlan, 20)
Sheets("EssPlan").Cells(iRowPlan, 24) =
Sheets("Plan").Cells(iRowPlan, 21)
Exit For
End If
Next iRowLTable
Next iRowPlan
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB code for following lookup, thanks pgarcia Excel Programming 0 July 24th 07 08:14 PM
Better lookup code? Ben Excel Programming 1 June 20th 06 03:45 PM
Zip Code Lookup Add-in GoFigure Excel Discussion (Misc queries) 12 February 20th 06 08:36 PM
Help with lookup code browie Excel Programming 1 June 13th 05 04:07 PM
code for lookup,& triggers. derek Excel Programming 3 July 22nd 03 05:04 AM


All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"