Thread: Im stuck in VB!
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Im stuck in VB!

Sub CreateLinks()

Dim LinkRange As Range, cell As Range
Set LinkRange = Range("G1", Range("G65536").End(xlUp))
On Error Resume Next
For Each cell In LinkRange
ActiveSheet.Hyperlinks.Add Anchor:=cell, Address:= _
Range("R" & cell.Row).Value, TextToDisplay:=cell.Value
Range("R" & cell.Row).ClearContents
Next

End Sub

--
Regards,
Tom Ogilvy

"D" wrote in message news:XDbSc.26608$Oi.437@fed1read04...
Hey guys-
Got a simple little script here that someone else wrote for me. It
hyperlinks contents from one column to the contents of another. Problem

is,
when one or more cells are blank in either column (either the location or
the friendlyname column), the macro breaks. I need something that will

tell
it to ignore blank cells and keep going until the end. Can someone tell me
how to do this? Thanks!
Here's the code...

Sub CreateLinks()

Dim LinkRange As Range, cell As Range
Set LinkRange = Range("G1", Range("G65536").End(xlUp))

For Each cell In LinkRange
ActiveSheet.Hyperlinks.Add Anchor:=cell, Address:= _
Range("R" & cell.Row).Value, TextToDisplay:=cell.Value
Range("R" & cell.Row).ClearContents
Next

End Sub

Thanks!
D