ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Im stuck in VB! (https://www.excelbanter.com/excel-programming/306569-im-stuck-vbulletin.html)

D[_6_]

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



Tom Ogilvy

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





D[_6_]

Im stuck in VB!
 
Tom- once again, you DA MAN!!! Thank you!!!


"Tom Ogilvy" wrote in message
...
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







D[_6_]

Im stuck in VB!
 
Tom-
Got a problem here. If the value of the Friendly name is a number, it will
not link it. If it starts with a letter or anything except a number, it
links it. Is there a way to make this hyperlink even when the friendlyname
is a number value?
Thanks
D



"D" wrote in message news:eMbSc.26609$Oi.13973@fed1read04...
Tom- once again, you DA MAN!!! Thank you!!!


"Tom Ogilvy" wrote in message
...
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









Tom Ogilvy

Im stuck in VB!
 
Hard to tell without knowing some specifics, but try this: Assume the
Friendly name is Range("R" & cell.row)Value

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:= _
format(Range("R" & cell.Row).Value,"@"), TextToDisplay:=cell.Value
Range("R" & cell.Row).ClearContents
Next

End Sub

--
Regards,
Tom Ogilvy


"D" wrote in message news:KxcSc.26612$Oi.18696@fed1read04...
Tom-
Got a problem here. If the value of the Friendly name is a number, it will
not link it. If it starts with a letter or anything except a number, it
links it. Is there a way to make this hyperlink even when the friendlyname
is a number value?
Thanks
D



"D" wrote in message news:eMbSc.26609$Oi.13973@fed1read04...
Tom- once again, you DA MAN!!! Thank you!!!


"Tom Ogilvy" wrote in message
...
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











D[_6_]

Im stuck in VB!
 
hmmm- nope- no go. Didn't do anything. Maybe I have to do a macro to go in,
add a letter or apostrophe, hyperlink it, then delete it. What a pain...
Thanks
D

"Tom Ogilvy" wrote in message
...
Hard to tell without knowing some specifics, but try this: Assume the
Friendly name is Range("R" & cell.row)Value

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:= _
format(Range("R" & cell.Row).Value,"@"), TextToDisplay:=cell.Value
Range("R" & cell.Row).ClearContents
Next

End Sub

--
Regards,
Tom Ogilvy


"D" wrote in message news:KxcSc.26612$Oi.18696@fed1read04...
Tom-
Got a problem here. If the value of the Friendly name is a number, it

will
not link it. If it starts with a letter or anything except a number, it
links it. Is there a way to make this hyperlink even when the

friendlyname
is a number value?
Thanks
D



"D" wrote in message news:eMbSc.26609$Oi.13973@fed1read04...
Tom- once again, you DA MAN!!! Thank you!!!


"Tom Ogilvy" wrote in message
...
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














All times are GMT +1. The time now is 06:28 PM.

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