Feb 19, 2007 #1 vbakan MIS Joined Dec 6, 2006 Messages 24 Location GB I want to round the decimal number to a hole number and it should always be just the hole number with out decimals eg 23.34526 = 23 0.563 = 0 23.7335 = 23
I want to round the decimal number to a hole number and it should always be just the hole number with out decimals eg 23.34526 = 23 0.563 = 0 23.7335 = 23
Feb 19, 2007 #2 Remou Technical User Joined Sep 30, 2002 Messages 13,030 Location BE You can use Int: Int(23.7335) Upvote 0 Downvote
Feb 19, 2007 #3 pacmanUK Technical User Joined Jun 30, 2004 Messages 2 Location GB Try something like this, the key part is WorksheetFunction, its 'calling' the standard Round function. Dim myVal1 As Long Dim myval2 As Integer myVal1 = 23.5555 myval2 = Application.WorksheetFunction.Round(myVal1, 0) MsgBox myval2 Cheers Upvote 0 Downvote
Try something like this, the key part is WorksheetFunction, its 'calling' the standard Round function. Dim myVal1 As Long Dim myval2 As Integer myVal1 = 23.5555 myval2 = Application.WorksheetFunction.Round(myVal1, 0) MsgBox myval2 Cheers
Feb 19, 2007 #4 Remou Technical User Joined Sep 30, 2002 Messages 13,030 Location BE pacmanUK In my version, Round(23.7335)=24, not 23. Upvote 0 Downvote
Feb 19, 2007 #5 pacmanUK Technical User Joined Jun 30, 2004 Messages 2 Location GB Apologies, When sending the response I read the text in the question rather than the title... vbakan - try application.worksheetfunction.rounddown(myval1,0) Upvote 0 Downvote
Apologies, When sending the response I read the text in the question rather than the title... vbakan - try application.worksheetfunction.rounddown(myval1,0)
Feb 19, 2007 #6 Remou Technical User Joined Sep 30, 2002 Messages 13,030 Location BE pacmanUK What have you got against Int? Microsoft Help said: INT Rounds a number down to the nearest integer. Syntax INT(number) Number is the real number you want to round down to an integer. Click to expand... You can use it in VBA, VB.Net, VBScript ... Upvote 0 Downvote
pacmanUK What have you got against Int? Microsoft Help said: INT Rounds a number down to the nearest integer. Syntax INT(number) Number is the real number you want to round down to an integer. Click to expand... You can use it in VBA, VB.Net, VBScript ...