Search : in
By :

Excel Custom Function

Last answer on Sep 18, 2009 10:36:49 am BST moses, on Sep 15, 2008 6:34:34 am BST 
 Report this message to moderators

Hello,

i have created a custom excel function which works fine. the only problem being, you need to press F2 on the custom formula cell and give enter to refresh the formula.

is there any way to refresh the formula every time the workbook is opened or before closing or while moving on to another row in the workbook.

thanks,
moses

Configuration: Windows XP
Firefox 3.0.1

Best answers for « Excel Custom Function » in :
EXCEL: The INTERSECTION function ShowEXCEL: The INTERSECTION function You have a table consisting of rows and columns. Want to know the value of the cell at the intersection of a particular row / column in your table Example: Your table: - starts C3 to F3 ... for...
Keyboard /Mouse Tips for Excel ShowKeyboard /Mouse Tips for Excel Intro Other Shortcuts Intro Excel tutorials give hints that make the difference between a needy use and flexibility. Here are some examples: Copy the highlight to the clipboard: [Ctrl + Ins] Paste...
Excel tips : How to insert date in a cell ShowExcel tips : How to insert date in a cell Below are some tips on how to insert date and time in an excel cell for a specific purpose:- To insert current date, press CTRL ¯+ ;¯ in the chosen cell. To insert current time, press CTRL¯+...
E-Procurement - Management of the purchasing function Showe-Procurement The term "e-Procurement" (for Electronic Procurement, sometimes written eprocurement) refers to the use of new technologies to automate and optimize the purchasing function of the company. The term refers to a B2B exchange, i.e. a...
Spreadsheets - The Excel Interface ShowExcel Introduction Microsoft Excel is the spreadsheet in the Microsoft Office office suite. To start it, simply click on the appropriate icon in the Start menu (in Windows) or click on an Excel file (that has an .xls file extension). A Excel...
Spreadsheet - Functions ShowThe Concept of a Function Spreadsheets generally have a large number of integrated functions for processing data. There are hundreds, categorised as follows: Arithmetic functions that offer basic tools to process numerical data Statistical...

1

kallor234, on Sep 15, 2008 10:34:29 am BST

Hello moses,

well i think this isnt unforfunately possible to be done in excel if you were using infopath then it could have been possible

Reply to kallor234

2

moses, on Sep 15, 2008 10:44:43 am BST

Hi...thanks for the try...maybe if u have a look at the code u can get a better picture
all is want is the formula to refresh itslef when u open or close workbook.


Function dis_multiple(end_date As Variant, msr_type As String, scheme As String, category As String, dob As Variant) As Variant
Dim title_row As Long
Dim age As Long
'Dim end_date As Date

Application.Calculation = xlCalculationAutomatic


Row = ActiveCell.Row
title_row = 5
age = Year(Now()) - Year(dob)

With ActiveSheet
msr_type = .Cells(Row, GetCol(title_row, "MSR Type"))
scheme = .Cells(Row, GetCol(title_row, "Scheme"))
category = .Cells(Row, GetCol(title_row, "Leaver Category"))
dob = .Cells(Row, GetCol(title_row, "DOB"))
end_date = .Cells(Row, GetCol(title_row, "Last Day Of Paid Service / Employment End Date"))
End With


end_month = Month(end_date)

'If msr_type = "" Or scheme = "" Or dob > 1900 Then

If msr_type = "New Joiners" And dob > 1900 Then
If scheme = "SORAS/DIS" Then
If age < 58 Then
dis_multiple = 4
Else
dis_multiple = 1
End If

Else
End If

Else
'MsgBox "Please see that the MSR Type and Date of Birth fields are filled in for New Joiners"
'Exit Function
End If

If msr_type = "Salary Alterations" Or msr_type = "Multiple Change" Or msr_type = "Transfers" Then
If scheme = "SORAS/DIS" Then
dis_multiple = 4
Else
End If
Else
End If



If msr_type = "Leavers" And scheme = "SORAS/DIS" Then
If category = "Regular" Then '
If end_month = Month(Now()) Then
dis_multiple = 4
Else
dis_multiple = 1
End If
ElseIf category = "Absconder" Then
dis_multiple = 4
ElseIf category = "Voluntary" Then
dis_multiple = 1
Else
MsgBox "Leaver category is blank"
End If
Else
End If


If msr_type = "New Joiners" Or msr_type = "Salary Alterations" Or msr_type = "Multiple Change" Or msr_type = "Transfers" Then
If scheme = "DIS/MS" Then
dis_multiple = 1
Else
End If
Else
End If

If msr_type = "Leavers" And scheme = "DIS/MS" Then
dis_multiple = 1
Else
End If

If msr_type = "New Joiners" Or msr_type = "Salary Alterations" Or msr_type = "Multiple Change" Or msr_type = "Transfers" Then
If scheme = "MS" Then
dis_multiple = 1
Else
End If
Else
End If

If msr_type = "" And scheme = "" And category = "" And dob = "" And end_date = "" Then
dis_multiple = ""
Else
End If


If scheme = "MS" Then
dis_multiple = ""
Else
End If


Application.Calculation = xlCalculationAutomati
End Function

Reply to moses

3

just-passing-by, on Nov 28, 2008 9:30:55 pm GMT
  • +5

Have you tried "Application.Volatile".

Reply to just-passing-by

7

 1 thing to add, on Sep 18, 2009 10:36:49 am BST
  • +1

Application.Volatile True
Add this to the beginning of the code, it will make excel recalculate the function every time anything is changed in the workbook (Also beore saving and after opening, if all goes well...). "True" is needed too I guess.

Reply to 1 thing to add

5

hey, on May 21, 2009 8:29:17 pm BST
  • +2

Try
Application.CalculateFull

Reply to hey

4

Cum_Shot, on May 14, 2009 7:45:24 am BST

Hi,

I had the same problem once with my MS excel worksheet before.. When I input a formula in a cell and copied it to other cells, it copies the formula but displays the one from the originating cell. I had to press F2 then hit enter to "refresh" the cell. It would now then display the correct figure for the copied formula.

I didn't get to fix this problem with the said worksheet though. I just opened a new worksheet and all worked fine. I guess there was just some sort of bug with the file itself. Hope this helps.

Reply to Cum_Shot

6

Will, on Aug 28, 2009 1:56:38 am BST

Maybe you tried this before, but this may be the cause:

Go to Tools
Options
Calculation
Make sure it is in AUTOMATIC and not MANUAL

Reply to Will