View Single Post
  #7   Report Post  
Harlan Grove
 
Posts: n/a
Default

Lolly wrote...
..=2E.
After this I use your Formula as follows:


[unquoted]
Range("C150:H150").FormulaArray =3D Application.ConvertFormula( _
Formula:=3D"=3DVLOOKUP($A$21,$A$246:$P$345,{5,6,7, 8,9, 10},0)", _
FromReferenceStyle:=3DxlA1, _
ToReferenceStyle:=3DxlR1C1 _
)
Range("C150:H150").Value =3D Range("C150:H150").Value


I didn't really need to see the preceding macro code. What I wanted to
see was how you had included the code I proposed in your macro, and it
would have been better had you done what I asked and posted your
*ENTIRE* macro including the added code I had proposed rather than
second guessing and providing scraps of macro code.

If you're using the code immediately above with the '' as the first
character in the 2nd through 6th lines, then that's the problem. I had
thought they were just misquoting in your follow-up, but now I'm
beginning to believe they may be what you're trying to use.

I'll repeat from my first response. Try

Range("C150:H150").FormulaArray =3D Application.ConvertFormula( _
Formula:=3D"=3DVLOOKUP($A$21,$A$246:$P$345,{5,6,7, 8,9,10},0)", _
FromReferenceStyle:=3DxlA1, _
ToReferenceStyle:=3DxlR1C1 _
)

Note: NO '' chars at the beginning of any line. Followed by

Range("C150:H150").Value =3D Range("C150:H150").Value

I want the actual values in the cell.
When I use this Formula
Range("C150").Value =3D WorksheetFuncion.Vlookup(Range("A20"),
Range("A246:P345"), 4, False).
Then I get the Value

..=2E.

You realize *YOUR* original formula was

Range("C150:H150").Value =3D
Application.WorksheetFunction.Vlookup(Range("A21") ,Range("A2=AD46:P345"),

columns(5,6,7,8,9),False)

Now *YOU* have changed the first argument to VLOOKUP from A21 to A20.
If your original formula had included a typo, it's up to *YOU* to
modify any code or formulas in any responses that duplicate any & all
mistakes in your original. If you really mean to use A20 rather than
A21, then you need to change the code I'd originally provided to

Range("C150:H150").FormulaArray =3D Application.ConvertFormula( _
Formula:=3D"=3DVLOOKUP($A$20,$A$246:$P$345,{5,6,7, 8,9,10},0)", _
FromReferenceStyle:=3DxlA1, _
ToReferenceStyle:=3DxlR1C1 _
)