+ Reply to Thread
Results 1 to 5 of 5

compile error: expected array ; binomial asset pricer

  1. #1
    Registered User
    Join Date
    10-29-2017
    Location
    Miami, FL
    MS-Off Ver
    2010
    Posts
    76

    compile error: expected array ; binomial asset pricer

    hello,

    i am trying to create a binomial asset Pricer and am expecting an output of ~$6.37 from my code.

    i am getting the below error:
    error.png

    please help, thank you

    full code:
    BAPM_v1.xlsm

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: compile error: expected array ; binomial asset pricer

    Well, variable S is passed as a Double. The line of code that's failing is trying to reference S as if it were a two-dimensional array. VBA is expecting an array when you reference array indices but it's not an array; it's a Double.

    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Post Re: compile error: expected array ; binomial asset pricer


    ( removed )

  4. #4
    Registered User
    Join Date
    10-29-2017
    Location
    Miami, FL
    MS-Off Ver
    2010
    Posts
    76
    Quote Originally Posted by WideBoyDixon View Post
    Well, variable S is passed as a Double. The line of code that's failing is trying to reference S as if it were a two-dimensional array. VBA is expecting an array when you reference array indices but it's not an array; it's a Double.

    WBD
    Gotcha!
    What Can I change it to? I don?t believe it needs to be an array. That line should output just 1 # per line

  5. #5
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: compile error: expected array ; binomial asset pricer

    Based on this page:

    https://en.wikipedia.org/wiki/Binomi..._pricing_model

    And adapting the algorithm on the right into VBA, this is what I came up with:

    Please Login or Register  to view this content.
    But it returns 5.251026 as the answer so perhaps it's not right?

    WBD

+ 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. need help with error : compile error expected array
    By eggs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-09-2017, 01:50 PM
  2. Replies: 0
    Last Post: 08-09-2017, 07:06 AM
  3. [SOLVED] Compile error: Expected Array
    By jkj115 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-27-2016, 03:01 PM
  4. [SOLVED] Compile error: expected array
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-11-2015, 04:06 AM
  5. [SOLVED] Help with Compile Error: Expected Array
    By g8r777 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-05-2012, 11:44 AM
  6. Compile Error: Expected Array
    By abfrempong in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-13-2012, 02:35 AM
  7. Compile Error - Expected Array
    By AccountantCost in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2009, 02:34 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