+ Reply to Thread
Results 1 to 4 of 4

VBA error question (Expected expression) Application.Worksheetfunction

  1. #1
    Registered User
    Join Date
    09-04-2014
    Location
    Utrecht, Netherlands
    MS-Off Ver
    2011
    Posts
    2

    VBA error question (Expected expression) Application.Worksheetfunction

    Helloooo everybody,

    I've been trying to get this to work almost all day now and I think I'm going insane. Basically what I want to do is get the following matrix function to work in VBA: =INDEX(Inkoopfacturen!$K:$K, SMALL(IF(Bankmutaties!$B$4=Inkoopfacturen!$J:$J, ROW(Inkoopfacturen!$J:$J)-ROW(Inkoopfacturen!$B$2)+1), ROW(1:1)))

    I've got this:

    Dim SearchValue As Range
    Dim SearchArea As Range
    Dim StartingPoint As Range
    Dim ResultArea As Range

    SearchArea = Worksheets("Inkoopfacturen").Range("J:J")
    SearchValue = Worksheets("Bankmutaties").Range("B2").End(xlDown).Offset(1, 4).Value
    ResultArea = Worksheets("Inkoopfacturen").Range("K:K")
    StartingPoint = Worksheets("Inkoopfacturen").Range("B2")


    Me.cboInkoopfactuur.AddItem Application.WorksheetFunction.INDEX(ResultArea, SMALL(IF(SearchValue=SearchArea; ROW(SearchArea)-ROW(StartingPoint)+1), ROW(1:1)))



    I get an error at the IF statement.

    Any tips or solutions would be terribly appreciated!

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA error question (Expected expression) Application.Worksheetfunction

    A Range is an object variable, and like all object variables, requires the keyword Set for assignment:

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    09-04-2014
    Location
    Utrecht, Netherlands
    MS-Off Ver
    2011
    Posts
    2

    Re: VBA error question (Expected expression) Application.Worksheetfunction

    Thanks for the tip. Still doesn't work, though

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA error question (Expected expression) Application.Worksheetfunction

    I have no idea what you're trying to do, but Small() and Row() are worksheet functions, just like Index. This is the point where you explain.
    Last edited by shg; 09-04-2014 at 01:25 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Compile Error: Expected: expression
    By Wheelie686 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2013, 08:51 AM
  2. Application.Worksheetfunction.match ERROR
    By Guido Meng in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2013, 01:27 PM
  3. [SOLVED] Compile Error: Expected Expression, Syntax Error
    By gjohn282 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2012, 11:28 PM
  4. VBA compilation error : expected expression error
    By raknahs in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-21-2010, 12:57 PM
  5. [SOLVED] if isna vlookup expected expression error
    By harishankarin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2010, 04:16 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1