|
-
Oct 28th, 2008, 03:34 PM
#1
Thread Starter
Junior Member
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?
-
Oct 28th, 2008, 04:57 PM
#2
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?
-
Oct 28th, 2008, 09:12 PM
#3
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
-
Oct 30th, 2008, 07:32 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|