PDA

View Full Version : Worksheet Formulas and VBA



kiyiya
08-02-2008, 10:09 PM
How do I get a worksheet formula to work with VBA?

Example: =IF(C41=TRUE, INDEX(PriceList_Prices,MATCH(F41,PriceList,0)),"")

My project is using a lot of INDEX and MATCH combos to retrieve data from named ranges and I can't seem to get them to work with VBA.

I want to be be able to include them on a Userform.

Thanks.

mdmackillop
08-03-2008, 01:36 AM
A small sample saves reponders separately creating workbooks/data/userforms to test their solutions, when you have this available already.

Bob Phillips
08-03-2008, 01:45 AM
Dim rng As Range

If Range("C41").Value Then

Set rng = Range("PriceList").Find(Range("F41"))
If Not rng Is Nothing Then

MsgBox Range("PriceList_Prices").Cells(rng.Row - Range("PriceList_Prices").Row + 1, 1).Value
End If
End If