LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Custom Function & Application.volatile

Hi, I'm new to Excel vba. Could someone help to answer my questions on custom
functions and Application.Volatile ?

I hava custom function which looks something like below. It uses
theApplication.Volatile statement. My question is: With this code, if this
function are in two workbooks with identical structure (i.e. SAME worksheet
names, SAME columns for Grade, Criteria , but different values), are the
calculations safely isolated to each workbook ?

Function GRADECALC(rngGrade, strCriteria, rngScore)

Application.Volatile

Dim Results, GradeCount, ScoreSum
Dim rngR As Range
Dim rngS As Range

Set rngR = Range(rngGrade, rngGrade.End(xlDown))
Set rngS = Range(rngScore, rngScore.End(xlDown))

ScoreSum = Application.SumIf(rngR, strCriteria, rngS)

GradeCount = Application.CountIf(rngR, strCriteria)


If GradeCount = 0 Then
Results = "No Grade " & strCriteria & " found."
Else


If (GradeCount 50) Then

Results = (ScoreSum / GradeCount) * 0.75

Else

Results = ScoreSum / GradeCount

End If

End If

GRADECALC = Results


End Function

Another thing, I saw a post by Niek Otten that says "if not all your data
comes into the function via the argument list, cells may still be calculated
in the wrong order".

Would this be applicable to the custom function above ? I have some doubts,
because the function gets the last cell and sets the ranges within the
function itself....

Thanks to anyone who can set me straight on this..
I'm using Excel 2003 on Win XP Pro btw.

Rgds,
Clare


 
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.Volatile not working Jas Excel Programming 4 September 15th 07 07:05 PM
Application.Volatile Nader Excel Programming 3 June 9th 06 04:14 PM
application.volatile activation Conceptor[_3_] Excel Programming 5 October 13th 04 09:59 PM
Need for Application.Volatile? Paul Lautman Excel Programming 2 August 19th 04 10:43 PM
Application.Volatile messing up other function itchyII Excel Programming 1 April 1st 04 04:31 PM


All times are GMT +1. The time now is 05:29 PM.

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

About Us

"It's about Microsoft Excel"