UDF return previous value

hobgoblinvasya

Board Regular
Joined
Jun 29, 2005
Messages
215
hey everyone, my question is pretty straightforward:

is there a way for a udf to return the cell's original value instead of an error.

ie. the UDF in the cell returned a value from a database. now if i move the database and reopen this sheet, excel will try to recalculate and if it doesn't find the database it will return an error. instead of that i just want excel to return whatever was in the cell, before it had to be recalculated.

is there any way to achieve this behaviour?

tnx in advance :)
 
Well...

You could do a BeforeSave event...

Take all of the values that are currently in the sheet and do a copy/paste special/values in to a second sheet called LastData or something like that.

Then use an IF statement with a check for the error.

=IF(ISERROR(Your UDF),Reference from LastData Sheet,Your UDF)

But their logic confuses me...

;)

hm.... thats actually in interesting idea - to recreate the values on another sheet AT WORKBOOK_SAVE. haven't thought of that. :D will try to play with it some more but looks promising. :)

thanks a bunch dude. now thats why you are excel mvps and im a simple noobie ;)
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,215,611
Messages
6,125,829
Members
449,266
Latest member
davinroach

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