ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vlookup woes (https://www.excelbanter.com/excel-programming/434602-vlookup-woes.html)

QB

vlookup woes
 
I coded the following, which worked beautifully in Excel 2003

Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC10,Configuration!R1C1:R" &
lstRowConfig & "C2,2,FALSE)"

Now however, in 2007 in get in the cell
=VLOOKUP(RC10,Configuration!R1C1:R10C2,2,FALSE)

but it does not actually return a value, it jsut displays the formula????
In 2003 it returned the value and everything worked like a charm?

Any ideas why it no longer works and how to fix it.

Thank you,

QB

Mike H

vlookup woes
 
Hi,

Nothing has changed in E2007 that would cause this, I suspect the cell into
which your putting the formula may be formatted as text. Try this

With Range("L2")
.NumberFormat = "General"
.FormulaR1C1 = "=VLOOKUP(RC10,Configuration!R1C1:R" & _
lstRowConfig & "C2,2,FALSE)"
End With

Mike

"QB" wrote:

I coded the following, which worked beautifully in Excel 2003

Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC10,Configuration!R1C1:R" &
lstRowConfig & "C2,2,FALSE)"

Now however, in 2007 in get in the cell
=VLOOKUP(RC10,Configuration!R1C1:R10C2,2,FALSE)

but it does not actually return a value, it jsut displays the formula????
In 2003 it returned the value and everything worked like a charm?

Any ideas why it no longer works and how to fix it.

Thank you,

QB


Jacob Skaria

vlookup woes
 
The below works both in 2003 and 2007

-Make sure you have the sheet named Configuration
-Also check whether the cell is formatted as 'General' and not as 'Text'

lstRowConfig = 2
Range("L2").FormulaR1C1 = "=VLOOKUP(RC10,Configuration!R1C1:R" & _
lstRowConfig & "C2,2,FALSE)"

If this post helps click Yes
---------------
Jacob Skaria


"QB" wrote:

I coded the following, which worked beautifully in Excel 2003

Range("L2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC10,Configuration!R1C1:R" &
lstRowConfig & "C2,2,FALSE)"

Now however, in 2007 in get in the cell
=VLOOKUP(RC10,Configuration!R1C1:R10C2,2,FALSE)

but it does not actually return a value, it jsut displays the formula????
In 2003 it returned the value and everything worked like a charm?

Any ideas why it no longer works and how to fix it.

Thank you,

QB



All times are GMT +1. The time now is 01:29 AM.

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