andrew nz
07-19-2017, 03:30 PM
Hi, I am very very rusty with using VBA in excel though I used to use it a lot. I am using Excel 2013 on Windows 8.1.
I added a user defined function to my spreadsheet called GetURL as module 4.
Public Function GetURL(rng As Range) As String
On Error Resume Next
GetURL = rng.Hyperlinks(1).Address
End Function
I saved my spreadsheet as a xlsm file.
I call it in the spreadsheet GetURL(N120).
Yesterday it worked fine. Today I copied the worksheet to a second sheet in the same file. Suddenly I got NAME errors for GetURL. I also got Name errors when I recalculated the function in the original sheet (same file). I can still see GetURL in module 4.
Any help. It looks to me like somehow the file has become corrupted as I opened an earlier version and everything is still working fine, including the added sheets!!! But it worries me that suddenly the sheet is not working as perhaps this will happen to the one which is currently working.
Any help appreciated
Andrew
I added a user defined function to my spreadsheet called GetURL as module 4.
Public Function GetURL(rng As Range) As String
On Error Resume Next
GetURL = rng.Hyperlinks(1).Address
End Function
I saved my spreadsheet as a xlsm file.
I call it in the spreadsheet GetURL(N120).
Yesterday it worked fine. Today I copied the worksheet to a second sheet in the same file. Suddenly I got NAME errors for GetURL. I also got Name errors when I recalculated the function in the original sheet (same file). I can still see GetURL in module 4.
Any help. It looks to me like somehow the file has become corrupted as I opened an earlier version and everything is still working fine, including the added sheets!!! But it worries me that suddenly the sheet is not working as perhaps this will happen to the one which is currently working.
Any help appreciated
Andrew