Rabu, 29 Februari 2012

Re: [ExcelVBA] How to convert double to integer

 

Hello Dawn

    intResult = Int(dblTime)
    dblTime = dblTime - intResult

No need for the If maybe ? 

Derek Turner +++

>________________________________
> From: Dawn Bleuel <dlbleuel@gmail.com>
>To: ExcelVBA <ExcelVBA@yahoogroups.com>
>Sent: Wednesday, 29 February 2012, 19:17
>Subject: [ExcelVBA] How to convert double to integer
>
>

>I need some help with something.
>
>In VBA I have a snippet of code...
>
>If dblTime > 1 Then
>intResult = dblTime
>dblTime = dblTime - intResult
>End If
>
>Works great if the value fed into dblTime is 1.454. The intResult = 1 and
>the dblTime becomes .454
>
>However, if the value of dblTime is 1.569 then the intResult becomes 2. I
>need it to stay at 1. I'm sure there is some kind of convert function that
>I'm not thinking of that will just extract the current whole number, but
>I've come up blank.
>
>Ideally, I want to end up with two variables splitting the whole number
>from the decimal.
>
>Thanks.
>
>--
>Dawn Bleuel
>Word MVP
>
>[Non-text portions of this message have been removed]
>
>
>
>
>

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar