Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.Volatile not working | Excel Programming | |||
Application.Volatile | Excel Programming | |||
application.volatile activation | Excel Programming | |||
Need for Application.Volatile? | Excel Programming | |||
Application.Volatile messing up other function | Excel Programming |