Lolly wrote...
....
After this I use your Formula as follows:
[unquoted]
Range("C150:H150").FormulaArray = Application.ConvertFormula( _
Formula:="=VLOOKUP($A$21,$A$246:$P$345,{5,6,7,8,9, 10},0)", _
FromReferenceStyle:=xlA1, _
ToReferenceStyle:=xlR1C1 _
)
Range("C150:H150").Value = 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 = Application.ConvertFormula( _
Formula:="=VLOOKUP($A$21,$A$246:$P$345,{5,6,7,8,9,10},0)", _
FromReferenceStyle:=xlA1, _
ToReferenceStyle:=xlR1C1 _
)
Note: NO '>' chars at the beginning of any line. Followed by
Range("C150:H150").Value = Range("C150:H150").Value
I want the actual values in the cell.
When I use this Formula
Range("C150").Value = WorksheetFuncion.Vlookup(Range("A20"),
Range("A246
345"), 4, False).
Then I get the Value
....
You realize *YOUR* original formula was
Range("C150:H150").Value =
Application.WorksheetFunction.Vlookup(Range("A21"),Range("A246
345"),
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 = Application.ConvertFormula( _
Formula:="=VLOOKUP($A$20,$A$246:$P$345,{5,6,7,8,9,10},0)", _
FromReferenceStyle:=xlA1, _
ToReferenceStyle:=xlR1C1 _
)