View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default getting cell values from worksheet

Sub Tester12()
For Each cell In Selection
sForm = cell.Formula
If InStr(1, sForm, "=hyperlink(", vbTextCompare) Then
sform1 = Right(sForm, Len(sForm) - 10)
iloc = InStr(sform1, ",")
sForm2 = Left(sform1, iloc - 1)
sForm2 = Right(sForm2, Len(sForm2) - 1)
sForm3 = Right(sform1, Len(sform1) - iloc)
sForm3 = Left(sForm3, Len(sForm3) - 1)

End If
cell.Offset(0, 1).Value = Evaluate(sForm2)
cell.Offset(0, 2).Value = Evaluate(sForm3)
Next

End Sub

--
Regards,
Tom Ogilvy




"dre" wrote in message
...
I have a an excel file that contains one worksheet.
The worksheet contains more than 1500 rows of hyperlinks.
I need to get the actual value of each cell that contains
a hyperlink on the worksheet. For example, The display
value for cell A2 is "Link to document". The actual value
for the cell A2 is "A2=hyperlink("document1.doc","Link to
document")". I need to parse through the cell values
extracting the values that is within the hyperlink
parentheses.

Any help would be appreciated.