ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vlookup Variables (https://www.excelbanter.com/excel-programming/378384-vlookup-variables.html)

Megadrone

vlookup Variables
 
I download a new spreadsheet everyday, this spreadsheet will have several new
rows everytime. I run a macro

What I need is for this lookup to automatically find the last row in the
table array

Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[8],'[Cell Refs Update Macro
V3.xls]Lookup'!R2C1:R1770C5,3,FALSE)"
Selection.AutoFill Destination:=Range("H2:H" & lastrow)

Can anybody help me?


Dave Peterson

vlookup Variables
 
Can you pick out a column that always has data in it when that row is used?

Dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row
end with

I used column A in my sample.

Megadrone wrote:

I download a new spreadsheet everyday, this spreadsheet will have several new
rows everytime. I run a macro

What I need is for this lookup to automatically find the last row in the
table array

Range("H2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[8],'[Cell Refs Update Macro
V3.xls]Lookup'!R2C1:R1770C5,3,FALSE)"
Selection.AutoFill Destination:=Range("H2:H" & lastrow)

Can anybody help me?


--

Dave Peterson


All times are GMT +1. The time now is 10:25 PM.

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