Rabu, 29 Februari 2012

Re: [ExcelVBA] How to convert double to integer

Perfect! Thank you so much!

Dawn Bleuel

On Wed, Feb 29, 2012 at 2:01 PM, Paul Schreiner <schreiner_paul@att.net>wrote:

> **
>
>
>
> try using:
> intResult = int(dblTime)
>
> actually, you could use:
>
> dbltime = dbltime - Int(dbltime)
>
> instead of the "if" statement
>
> but this would only work if dbltime is > 0
>
> Paul
> -----------------------------------------
> "Do all the good you can,
> By all the means you can,
> In all the ways you can,
> In all the places you can,
> At all the times you can,
> To all the people you can,
> As long as ever you can." - John Wesley
> -----------------------------------------
>
> ________________________________
> From: Dawn Bleuel <dlbleuel@gmail.com>
> To: ExcelVBA <ExcelVBA@yahoogroups.com>
> Sent: Wed, February 29, 2012 2:17:54 PM
> 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]
>
>
>

--
Dawn Bleuel
"*Dedicated to Living Healthier"*
Live Total Wellness
www.LiveTotalWellness.com\dbleuel <http://www.livetotalwellness.com/dbleuel>


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

------------------------------------

----------------------------------
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

----------------------------------Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ExcelVBA/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/ExcelVBA/join
(Yahoo! ID required)

<*> To change settings via email:
ExcelVBA-digest@yahoogroups.com
ExcelVBA-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
ExcelVBA-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar