Results 1 to 4 of 4

Thread: Integer Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2008
    Posts
    28

    Integer Problem

    I have some calculations that are returning a number very near an integer, which is feeding into a variable that is defined as an integer. I am using CInt() but the unrounded number is feeding through. I have also tried Worksheets.Application.Round(). Neither are working.

    Thoughts?

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Integer Problem

    Thread moved from the FAQ forum, which is not the place to post your questions.

    Care to show us the code, and let us know what the values before & after are?

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Integer Problem

    a variable declared as an integer can not hold any decimal part
    so do you mean sometimes the integer is rounded up and sometimes rounded down?
    if you want always rounded down, use fix()
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Integer Problem

    Are you looking for a whole number or a decimal?

Posting Permissions

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



Click Here to Expand Forum to Full Width