Although my first post to the MrExcel forum, I have been using you folks more and more in recent months whenever I've run into coding issues.
In light of that fact, I am in need of assistence to determine how to intercept the error #VALUE! from showing up in my VBA hyperlink extraction function. Here's an excerpt:
If used on a referenced cell that contains a hyperlink, it works fine. This also passes well if the cell is blank. But I cannot for the life of me figure out how to make it check ahead for the hyperlink to determine if it should or not...and trust me, Jonnyabc didn't just pickup a beginner's programming book just yesterday, so test out your solution before you tell me something I've already tried.
Let me list out a few things I've found:
Still no clue at all where the problem lies so any assistance is welcome! It's probably a really simple tweak that I haven't tried (or messed up when my eyes were getting bloodshot.
Thanks folks! And remember that people outside of your valuable forum really do read and need this stuff too! Have a great day, and I hope this won't be our last great discussion together!
In light of that fact, I am in need of assistence to determine how to intercept the error #VALUE! from showing up in my VBA hyperlink extraction function. Here's an excerpt:
Code:
Option Explicit
Function URL(rngValue As Range) As String
If rngValue <> "" Then
URL = CStr(rngValue.Hyperlinks.Item(1).Address)
Else
URL = ""
End If
End Function
Let me list out a few things I've found:
- I've used the IF statement to determine if Item(1).Address is null using various ISNULL() ISEMPTY() ISMISSING() ISERROR() functions to no avail. Once after debugging I found a critical issue: once Excel determines there was no hyperlink, it abruptly ends the function and returns #VALUE!, ignoring all future code in the function, although not displaying any VBA errors.
- #VALUE!, while it can be copied and tested in an Excel cell as text, cannot be tested as such in VBA because neither ISERROR() nor Application.WorksheetFunction.IFERROR() seems to find or replace the error. I've even converted the value to a string to no avail!
Still no clue at all where the problem lies so any assistance is welcome! It's probably a really simple tweak that I haven't tried (or messed up when my eyes were getting bloodshot.
Thanks folks! And remember that people outside of your valuable forum really do read and need this stuff too! Have a great day, and I hope this won't be our last great discussion together!