Thread: Im stuck in VB!
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
D[_6_] D[_6_] is offline
external usenet poster
 
Posts: 34
Default Im stuck in VB!

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