Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

converting fortran to vba - SOLVED -

legalizemelegalizeme Posts: 6Member
I`m converting subroutine from fortran code into the excel. But I faced a problem, that these loops, which are working correctly under fortran, are not working "correctly" under vba. Lost all day trying to figure out problem without success.

Comments

  • quikcarlquikcarl Posts: 59Member
    [b]What loops?[/b] I didn't see any DO loops inside
    the subroutine. Just a lot of IF-THEN-ELSE-
    ENDIF statements. You might want to indent
    inside the IF statements to see if there is
    something missing and the FORTRAN compiler is
    compensating.


  • legalizemelegalizeme Posts: 6Member
    Please, dont focus on that loop, I didn`t add a loop in attachment, just subroutine. The thing is that this subroutine is inside the loop. abstractly it should look like

    [code]
    do until eof(sample_data)

    get_step_parameters(sample_data)

    call mysubroutine(parameters,form,sample,data,and,many,many2,more,parameters,which,are,calculated,from,previous,loop,by,reference)

    debug.print which,are

    many=0
    many2=0
    more=0

    sumBy=sumBy+by

    loop
    [/code]

    In the same if-then-else system i have a different results running it under fortran and under VBA. E.g. If I`m processing input_data file with 2250 records, the summoned parameters, like "sumBy" here, it differ about 0,5% of it`s value. In fortran it`s 1085, in VBA - 1045.

    If someone wants to play around with this and prove me wrong, I`m adding full code in attachment.

  • legalizemelegalizeme Posts: 6Member
    This post has been deleted.
  • legalizemelegalizeme Posts: 6Member
    problem solved.
    before calling sub "snow" there were variable with default value all the time.



Sign In or Register to comment.