PDA

View Full Version : Solved: .FormulaR1C1 VBA



anthony20069
02-18-2013, 07:40 AM
Hey guys,

Been trying to play around with the .FormulaR1C1 in VBA but with no luck

i have the following
'Vlookup
Set rMy_Range = .Range("F6:F" & iLast_row)
' rMy_Range.Select
rMy_Range.FormulaR1C1 = "=VLOOKUP(R[0]C[-1],'Search Criteria'!C2:D89,2,FALSE)"

But it brings populate the cells with the following:
=VLOOKUP(E6,'Search Criteria'!$B:$B:'D89',2,FALSE)

As you can see the tablelookup i.e. ",'Search Criteria'!C2:D89" is set but this seems to be ignored...

Any help?

p45cal
02-18-2013, 08:35 AM
rMy_Range.FormulaR1C1 = "=VLOOKUP(R[0]C[-1],'Search Criteria'!R3C3:R89C4,2,FALSE)"
?

anthony20069
02-18-2013, 09:51 AM
:) DOH!

Forgot to change to r1c1!!!

p45cal
02-18-2013, 10:33 AM
rMy_Range.FormulaR1C1 = "=VLOOKUP(R[0]C[-1],'Search Criteria'!R3C3:R89C4,2,FALSE)"
?rMy_Range.FormulaR1C1 = "=VLOOKUP(R[0]C[-1],'Search Criteria'!R2C3:R89C4,2,FALSE)"

anthony20069
02-19-2013, 02:59 AM
Yeah saw that,

Thanks a lot for the help p45cal....