Consulting

Results 1 to 3 of 3

Thread: Worksheet Formulas and VBA

  1. #1
    VBAX Regular
    Joined
    Jun 2008
    Posts
    53
    Location

    Worksheet Formulas and VBA

    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.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    A small sample saves reponders separately creating workbooks/data/userforms to test their solutions, when you have this available already.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •