Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-10-2014, 11:09 AM
Deepak Kishwar Deepak Kishwar is offline udf value not getting refreshed , have to click on each - pls help Windows Vista udf value not getting refreshed , have to click on each - pls help Office 2007
Novice
udf value not getting refreshed , have to click on each - pls help
 
Join Date: May 2014
Posts: 2
Deepak Kishwar is on a distinguished road
Default udf value not getting refreshed , have to click on each - pls help

í have some value stored in worksheet as below

Name Sum Assuured Age Prem to be paid
Jacobs 300000 35 2879
Steve 400000 24 3686
Amit 400000 46 5954
Deepak 600000 78 15596
Ajay 300000 90 10347
Samuel 400000 55 5954
Tom 300000 65 5422
Russell 400000 72 10023

i have written a udf function as below :




Option Explicit
'Main Function
Function premium(ByVal MyNumber)
Dim Sumass As Long
Dim asage As Long
Dim prem As Long

Sumass = Cells(ActiveCell.Row, 2)
asage = MyNumber
Select Case Sumass
Case 300000
If asage < 36 Then prem = 2879
If asage > 35 And asage < 46 Then prem = 3188
If asage > 45 And asage < 56 Then prem = 4698
If asage > 55 And asage < 66 Then prem = 5422
If asage > 65 And asage < 71 Then prem = 7033
If asage > 70 And asage < 76 Then prem = 7865
If asage > 75 Then prem = 10347

Case 400000
If asage < 36 Then prem = 3686
If asage > 35 And asage < 46 Then prem = 4103
If asage > 45 And asage < 56 Then prem = 5954
If asage > 55 And asage < 66 Then prem = 6950
If asage > 65 And asage < 71 Then prem = 8989
If asage > 70 And asage < 76 Then prem = 10023
If asage > 75 Then prem = 13139


Case 600000
If asage < 36 Then prem = 4285
If asage > 35 And asage < 46 Then prem = 4823
If asage > 45 And asage < 56 Then prem = 7160
If asage > 55 And asage < 66 Then prem = 8393
If asage > 65 And asage < 71 Then prem = 10955
If asage > 70 And asage < 76 Then prem = 11970
If asage > 75 Then prem = 15596

End Select
premium = prem
End Function

in column 4 i have put the value = premium(c3) and dragged to the last row
but it is giving odd result but if i click on each cell and press enter it gives the correct result

i think i'm missing something in the udf, please help
Attached Files
File Type: xlsm Medical premium.xlsm (18.2 KB, 13 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
I used to be able to right click on Outlook Are Square Outlook 0 02-20-2013 03:18 AM
udf value not getting refreshed , have to click on each - pls help on click increment gsrikanth Excel Programming 1 02-23-2012 08:19 AM
Can the "Sent Items" folder be refreshed? Robbyrob720 Outlook 2 10-20-2011 06:38 PM
udf value not getting refreshed , have to click on each - pls help Right click in Macro MShroff Word VBA 4 04-05-2011 09:00 PM
Click -to run headache lazarus34 Office 0 09-14-2010 08:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft