Forum

Calling a Function ...
 
Notifications
Clear all

Calling a Function using Hyperlink

4 Posts
2 Users
0 Reactions
565 Views
(@pjm)
Posts: 16
Eminent Member
Topic starter
 

Hi,

I recall Mynda using a function as the first parameter of a Hyperlink function to control a dashboard.

However, whenever I now try to replicate this I find the hyperlink shows ‘#value’.  I’ve broken down what I recall of the method as far as I can and am using the functions and code shown below as tests.  The code works and updates cell E1 to either “Updated” or “Cleared” as appropriate (I use the ‘cellupdated’ variable simply to stop the dostuff() function being called multiple times), but nothing I do will show the ‘friendly name’.  I also tried to use the application.ontime function to clear the cell, but that never runs either.

I suspect its a limitation of the using Hyperlink this way, but I’d be grateful for any advice or direction to solve the problem.

The hyperlinks and the associated code are as follows:

                In C4: =hyperling(dostuff(), “a Function”)

                In C6: =hyperlink(doclear(),”doclear”)

 


Dim cellupdated As Boolean

 

Function dostuff()

If Not cellupdated Then

    cellupdated = True

    Range("E1") = "Updated"

End IF

End Function

 

 

Function doclear()

    cellupdated = False

    Range("E1") = "cleared"

End Function

 
Posted : 08/05/2020 9:59 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Peter,

You just need to wrap the HYPERLINKS in IFERROR because mousing over the link will generate an error.

=IFERROR(HYPERLINK(dostuff(), "DoStuff"),"DoStuff")

See attached.

regards

Phil

 
Posted : 09/05/2020 12:11 am
(@pjm)
Posts: 16
Eminent Member
Topic starter
 

Thanks Phil, much appreciated - I wish I'd realised it was that simple.  I'm learning.  Many thanks.

 
Posted : 23/05/2020 9:13 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

No worries 🙂

 
Posted : 23/05/2020 7:42 pm
Share: