ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Vaiable in range().formula (https://www.excelbanter.com/excel-programming/376804-vaiable-range-formula.html)

Sune Fibaek

Vaiable in range().formula
 
Hi

This is probably quite trivial, but how do I do somthing like this:

ActiveSheet.Range("A1").Formula "=VLOOKUP(" & strLookValue(intLookNum) &
",Setup!A1:A15,2,FALSE)"

I am trying to add a variable from an array to the VLOOKUP formula.

/Sune

Bob Phillips

Vaiable in range().formula
 
Maybe you need

ActiveSheet.Range("A1").Formula = "=VLOOKUP(""" & _
strLookValue(intLookNum) & """,Setup!A1:A15,2,FALSE)"

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Sune Fibaek" wrote in message
...
Hi

This is probably quite trivial, but how do I do somthing like this:

ActiveSheet.Range("A1").Formula "=VLOOKUP(" & strLookValue(intLookNum) &
",Setup!A1:A15,2,FALSE)"

I am trying to add a variable from an array to the VLOOKUP formula.

/Sune




Sune Fibaek

Vaiable in range().formula
 

Maybe you need


That just may be!

ActiveSheet.Range("A1").Formula = "=VLOOKUP(""" & _
strLookValue(intLookNum) & """,Setup!A1:A15,2,FALSE)"


The third quote did the trick. I'd tried two, but not three.

Thank you very much!

/Sune

Dave Peterson

Vaiable in range().formula
 
I bet you have to increase the number of columns in your lookup range, too.

A1:B15????

Sune Fibaek wrote:

Hi

This is probably quite trivial, but how do I do somthing like this:

ActiveSheet.Range("A1").Formula "=VLOOKUP(" & strLookValue(intLookNum) &
",Setup!A1:A15,2,FALSE)"

I am trying to add a variable from an array to the VLOOKUP formula.

/Sune


--

Dave Peterson

Sune Fibaek

Vaiable in range().formula
 
Dave Peterson wrote:
I bet you have to increase the number of columns in your lookup range, too.

A1:B15????

Hi Dave,

Well, yes it would be hard pressed to find the second row in my range,
wouldn't it? The formula was not exactly a copy-paste job from the
actual code.

Sharp eyes!

/Sune


All times are GMT +1. The time now is 10:40 AM.

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