Forum Discussion
hrh_dash
Jun 13, 2022Iron Contributor
Excel workbook hangs up when vlookup vba is executed
I have coded a simple vlookup vba code; it works but whenever i try to execute it, the whole workbook got hanged. Is there any way to fix this? Vlookup is executed with 244k rows of data. Su...
HansVogelaar
Jun 13, 2022MVP
I notice that lastRow is the last used row on Sheet2 in the workbook that you open.
But you use it in a loop For i = 2 To lastRow to fill cells on a sheet in the macro workbook. Is that really what you want? You'd be processing 244,000 rows!
hrh_dash
Jun 13, 2022Iron Contributor
HansVogelaar , i know its crazy but is it possible? the reason is because i don't want other to see the formula and wish to lock the column so that no one could amend anything in that column.
- HansVogelaarJun 13, 2022MVP
But why do you use the last used row on the other sheet in a loop for the sheet in the macro workbook?
- hrh_dashJun 13, 2022Iron Contributor
HansVogelaar , , lastRow is actually intended for the macro workbook with 244k rows. Hence, the for loop to execute the vlookup from row 2 to the last blank row.
- HansVogelaarJun 14, 2022MVP
Looping through 244K rows will take a LOT of time!