ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom function problems (https://www.excelbanter.com/excel-programming/301687-custom-function-problems.html)

Andrew B[_2_]

Custom function problems
 
Hi
I have created a marksbook file that calculates marks for students. I need
to use some custom functions that I have created to make the calculation
process smoother. I only turn calculation on when required. For the most
part the functions seem to work fine. However from time to time, something
seems to trigger them so that they stop working. In the process of using
the marksbook, calculation is turned on and off, protection on certain cells
is turned on and off and events are turned on and off when required.
Do I need to recalculate more often to fix them problem ? For exanple, when
any cell is changed on the sheet, is function recalculation required ? Any
ideas would be helpful. Here is an example of one of the functions I created
and use in the marksbook.



Function MU4TT(rng)
F = 0: L = 0
For k = 25 To 29
If IsNumeric(Cells(rng.Row, k)) = False Then GoTo Ntk
If Cells(rng.Row, k) = "" Then GoTo Ntk
F = F + Cells(rng.Row, k) / 100 * Cells(2, k)
L = L + Cells(2, k)
Ntk:
Next k
If L = 0 Then
MU4TT = ""
Else
MU4TT = Int(F / L * 100 + 0.5)
End If
End Function

Thanks in advance
Andrew Bourke





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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com