ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Script to recognize hyperlinks? (https://www.excelbanter.com/excel-programming/321006-script-recognize-hyperlinks.html)

[email protected]

Script to recognize hyperlinks?
 
I'm using a for each...next loop to examine a range of cells that was
brought in through a web query. For each cell, I need to evaluate if
it's hyperlinked and if so, if it has text in it or is a blank cell
with a hyperlink or is a cell with text buy no hyperlink. What do I
put in my if statements to distinguish these possibilities?

TIA,
Jim


Dave Peterson[_5_]

Script to recognize hyperlinks?
 
Maybe something like this will get you started:

Option Explicit
Sub testme()
Dim myCell As Range
Dim myRng As Range

Set myRng = ActiveSheet.Range("a1:a3")

For Each myCell In myRng.Cells

If myCell.Hyperlinks.Count 0 Then
MsgBox "has link"
Else
MsgBox "no link"
End If

If IsEmpty(myCell.Value) Then
MsgBox "it's empty"
Else
MsgBox "it's not empty"
End If

Next myCell

End Sub


wrote:

I'm using a for each...next loop to examine a range of cells that was
brought in through a web query. For each cell, I need to evaluate if
it's hyperlinked and if so, if it has text in it or is a blank cell
with a hyperlink or is a cell with text buy no hyperlink. What do I
put in my if statements to distinguish these possibilities?

TIA,
Jim


--

Dave Peterson


All times are GMT +1. The time now is 07:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com