+ Reply to Thread
Results 1 to 3 of 3

Passing in values

  1. #1
    Registered User
    Join Date
    06-26-2007
    Posts
    36

    Passing in values

    Hi,

    i have attached parts of my code which is not doing properly as i am not sure which part of it is wrong.
    Please Login or Register  to view this content.
    It does not seems to be able to calculate ff

    http://www.mrexcel.com/board2/viewto...364790#1364790
    Last edited by froggy19; 07-19-2007 at 03:47 AM.

  2. #2
    Registered User
    Join Date
    06-26-2007
    Posts
    36
    Hi,

    i realise the problem only happens when the values in my worksheet "Data" is too small such that when the multiplication is done, the value is rounded to nearest integer so when my value is 0.01 etc, when multiplication is done, the answer i get will be 0. But when my value is 1, i get the exact answer. Is it possible for me to set in Excel vba to accept digits with decimal places and not have them round to nearest integer?

    Thank you.

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Step 1 is to declare your variables correctly

    In your code
    Please Login or Register  to view this content.
    Only fo is declared as long type all others are variable types.
    Long type can not hold decimal numbers. Use Double type

    To declare variables correctly you must have variable name followed by As Type

    example
    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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