Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Application vs WorksheetFunction

I'm not sure where this should go so I've posted to both the formula
and vba groups, as well as the old programming group.

Chip Pearson has written that the only difference, when calling an
Excel worksheetfunction, between using the Application object vs the
WorksheetFunction is error handling.

However, the following gives different results, for what appears to be
the same function. (The result is the same if SheetCredit is declared
as Double).

=========================
Option Explicit
Sub foo()
Const CashIn As Currency = 53.4
Const CashDue As Currency = 54.175
Dim SheetCredit As Currency

SheetCredit = CashIn - CashDue

Debug.Print "SheetCredit not Rounded", , SheetCredit

Debug.Print "WorksheetFunction.RoundDown:", _
WorksheetFunction.RoundDown(SheetCredit, 2)

Debug.Print "Application.RoundDown:", , _
Application.RoundDown(SheetCredit, 2)

End Sub
===============================

Immediate Window:

SheetCredit not Rounded -0.775
WorksheetFunction.RoundDown: -0.77
Application.RoundDown: -0.78

-----------------------------------------------------------------
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Application vs WorksheetFunction

On Sun, 15 Aug 2010 21:22:01 -0400, Ron Rosenfeld
wrote:

(The result is the same if SheetCredit is declared
as Double).


That should read that the result of either Application.rounddown or
Worksheetfunction.RoundDown is the same ... In other words, it works
as expected if SheetCredit is Double.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
application.worksheetfunction JP Ronse Excel Programming 8 August 23rd 09 04:26 PM
Need help with Application.WorksheetFunction Ayo Excel Discussion (Misc queries) 4 May 14th 08 11:13 PM
application.worksheetfunction Ozgur Pars[_2_] Excel Programming 4 July 18th 06 08:11 AM
Application.worksheetfunction Terry V Excel Programming 7 October 12th 04 05:48 AM
Using Application.WorksheetFunction.Ln(...) in VBA doco Excel Programming 4 August 25th 03 01:08 PM


All times are GMT +1. The time now is 01:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"