VLOOKUP table_array parameter as a variable
Solved/Closed
NotSoEXCELlent
-
Aug 2, 2011 at 07:38 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Aug 3, 2011 at 01:41 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Aug 3, 2011 at 01:41 PM
Related:
- VLOOKUP table_array parameter as a variable
- My documents environment variable - Guide
- Parse error: syntax error, unexpected variable - Guide
- Vlookup to find missing data in 2 columns - Excel Forum
- Transfer data from one excel worksheet to another automatically vlookup ✓ - Excel Forum
- Removing "FALSE" from an IF statement with a VLOOKUP ✓ - Excel Forum
1 response
rizvisa1
Posts
4478
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
766
Aug 3, 2011 at 05:55 AM
Aug 3, 2011 at 05:55 AM
You mean some thing like this
lastrow = cells(rows.count, "A").end(xlup).row
lastcol =cells(1, columns.count).end(xltoleft).column
src = "R2C1:R" & lastrow & "C" & lastcol
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-10],Position!" & src & ",2,FALSE)"
lastrow = cells(rows.count, "A").end(xlup).row
lastcol =cells(1, columns.count).end(xltoleft).column
src = "R2C1:R" & lastrow & "C" & lastcol
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-10],Position!" & src & ",2,FALSE)"
Aug 3, 2011 at 10:53 AM
Aug 3, 2011 at 11:08 AM
Aug 3, 2011 at 11:22 AM
Dim src As String
Dim ws As Worksheet
Set ws = Sheets("Position")
lastRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
lastColumn = ws.Cells(1, Columns.Count).End(xlToLeft).Column
src = "R1C1:R" & lastRow & "C" & lastColumn
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-10],Position!" & src & ",2,FALSE)"
Aug 3, 2011 at 01:41 PM
but the variable should have been (as you correctly used) src