+ Reply to Thread
Results 1 to 6 of 6

functions with Dim as Double

  1. #1
    Forum Contributor
    Join Date
    09-19-2004
    Posts
    252

    functions with Dim as Double

    I have a function in which I pull in cost and dnet and want to do multiplication with it. For some reason this doesn't work when I change Cost as string and DNET as string to Cost as double and DNET as double.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    Hi, I think its because you have "Cost" and "DNET" being <> than an "Empty String" when the variables are doubles, It should be a Numerical ref.
    Your Code modified below works.
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Forum Contributor
    Join Date
    09-19-2004
    Posts
    252
    That's it! Thanks!

    Hmm, I'm using double because I want the format to be 0.00 but it's not coming through like that. It is showing more than 2 after the decimal place. Is there another one I can use?

    Also, is there a way to display the date in the following format?
    08-28-08
    in a cell I would use the following
    Please Login or Register  to view this content.
    but text doesn't seem to work in visual basic.

  4. #4
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    You can use Format to format your output:

    Please Login or Register  to view this content.
    It's worth noting that Double refers to the datatype and not how many decimal places a value of this type will hold.

    Richard

  5. #5
    Forum Contributor
    Join Date
    09-19-2004
    Posts
    252
    Thank you
    and with your direction of Format I was able to use the following for my date
    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    That could be truncated to:

    Please Login or Register  to view this content.

+ 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. Converting Latitude/longitude to OSGB grid ref
    By Greenspan in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-10-2020, 12:43 PM
  2. Is there a way to clear all variables after a loop?
    By gshock in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-12-2008, 11:34 AM
  3. derivatives of a cubic spline
    By johnboy12 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-20-2008, 02:49 AM
  4. double lookup functions
    By girth69 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-13-2008, 08:06 AM
  5. Invalid procedure call or argument
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-08-2007, 06:01 AM

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