VBA Custom Function Question

jk1

New Member
Joined
Aug 24, 2011
Messages
1
Quick question that might help clear up some confusion for me. I'm using a custom function that I wrote that is not always updating. The function itself is pretty straight forward, but difficult to explain outside of the context of the file it is being used in. However, below is an example of how the spreadsheet is set up in a very simplified way.

Question is ... When I change cell A1, should B2 update?

My understanding is yes, but this the is only thing I can think of that would be causing my problem.

Thanks much in advance


Function Test(TestValue)
Test = TestValue * TestValue
End Function


Spreadsheet
A1: "5"
A2: "=A1"

B2: "=TestValue(A2)"
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Yes, the function should update when you change any precedent cell and calculation is set to automatic.

A common reason that UDFs don't update is because not all of their immediate precedents are passed as arguments, so Excel sees no dependency. That's not the case with your simple function, but that's not your real function.

A1 should contain the number 5, not the text "5", and the UDF should declare the type of argument it expects in the signature:

Code:
Function Test(TestValue As Double)
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top