Hello all,

I have a user defined function that essentially does a bunch of "count if's" and returns and answer.
When I alt:tab between spreadsheets I have noticed all the values that were viewable changed to display "#Value!".

Nothing within the spreadsheet has changed and vba code also hasnt changed.

so... to try to fix this I created a refresh macro "Refresh" which is just a simple...
Sub Refresh()
Dim r As Integer

r = 1

Do While r < 80
    Range("A" & r).Calculate
    r = r + 5
Loop

End Sub
and this fixed it!.... once. If i want to get this to run a second time, I have to modify the VBA (even if it means just deleting the 5 and adding it back in....)

Is there a refresh button that I can use that would actually correct this every time?
Is there a way I can prevent the function being so volatile and easy to turn to "#Value!"?

Kind Regards,
Penfold