ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using a Macro to perform a VLookup on varying number of rows (https://www.excelbanter.com/excel-programming/339206-using-macro-perform-vlookup-varying-number-rows.html)

Shirley Munro[_3_]

Using a Macro to perform a VLookup on varying number of rows
 

Hi

I am using a VLookup to find a show a match in column A from a lis
contained in another file. The lookup works fine, however, I want t
automate the task by using a Macro. I can copy and paste the looku
formula down the remaining cells in column A but my problem is tha
this file is loaded on a regular basis and does not necessarily hav
the same number of rows in it the next time it is loaded. I need t
copy the lookup into the last active cell in column A. Any suggestion
would be much appreciated.


Shirle

--
Shirley Munr
-----------------------------------------------------------------------
Shirley Munro's Profile: http://www.excelforum.com/member.php...info&userid=83
View this thread: http://www.excelforum.com/showthread.php?threadid=40190


gearoi[_14_]

Using a Macro to perform a VLookup on varying number of rows
 

A number of get-arounds:

1 - use a named range for the vlookup. Redefine the named range from
macro then go
2 - use the range right down to the bottom of the spreadsheet (this i
the easiest workaround). ie to row 65536. You don't need to worry ho
many rows there are now.
3 - use code to look it up. Depends on what else you're doing.
4 - get a macro to update your vlookup formula depending on the numbe
of rows by using string manipulations to make the C3:F2000 bit.


I'm sure there's more but I use 2 unless there are other thing
happening making the other things worth doing

--
gearo
-----------------------------------------------------------------------
gearoi's Profile: http://www.excelforum.com/member.php...fo&userid=2657
View this thread: http://www.excelforum.com/showthread.php?threadid=40190



All times are GMT +1. The time now is 12:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com