#1   Report Post  
Posted to microsoft.public.excel.misc
Ken Ken is offline
external usenet poster
 
Posts: 4
Default dynamic hyperlink

Greetings,

there is a column is number, I want to add a hyperlink to the each
number.
for example,

item A, row 1 is number 1, after the adding the hyperlink to it which
displays 1 but I can click it and link to http://example.com?id=1.
and for row 2, the link will be http://example.com?id=2, and so on.

how to do this?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default dynamic hyperlink

You don't even need that other column of numbers.

Put this in A1:
=hyperlink("http://example.com?id="&row())





Ken wrote:

Greetings,

there is a column is number, I want to add a hyperlink to the each
number.
for example,

item A, row 1 is number 1, after the adding the hyperlink to it which
displays 1 but I can click it and link to http://example.com?id=1.
and for row 2, the link will be http://example.com?id=2, and so on.

how to do this?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default dynamic hyperlink

But if you did have numbers in column A, you could use this in B1:

=hyperlink("http://example.com?id="&a1)



Dave Peterson wrote:

You don't even need that other column of numbers.

Put this in A1:
=hyperlink("http://example.com?id="&row())

Ken wrote:

Greetings,

there is a column is number, I want to add a hyperlink to the each
number.
for example,

item A, row 1 is number 1, after the adding the hyperlink to it which
displays 1 but I can click it and link to http://example.com?id=1.
and for row 2, the link will be http://example.com?id=2, and so on.

how to do this?


--

Dave Peterson


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
Ken Ken is offline
external usenet poster
 
Posts: 4
Default dynamic hyperlink

thanks, that makes sense, but I still have a problem while I'm trying
to put this in A1,
=hyperlink("http://example.com?id=&a1, a1), I got an error saying excel
can't calculate a formula.
can you help?

Dave Peterson 写道:

You don't even need that other column of numbers.

Put this in A1:
=hyperlink("http://example.com?id="&row())





Ken wrote:

Greetings,

there is a column is number, I want to add a hyperlink to the each
number.
for example,

item A, row 1 is number 1, after the adding the hyperlink to it which
displays 1 but I can click it and link to http://example.com?id=1.
and for row 2, the link will be http://example.com?id=2, and so on.

how to do this?


--

Dave Peterson


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default dynamic hyperlink

Don't put it in A1.
Put your numbers in column A and put this in B1:

=hyperlink("http://example.com?id="&a1, a1)

(watch your quotes!)

Ken wrote:

thanks, that makes sense, but I still have a problem while I'm trying
to put this in A1,
=hyperlink("http://example.com?id=&a1, a1), I got an error saying excel
can't calculate a formula.
can you help?

Dave Peterson 写道:

You don't even need that other column of numbers.

Put this in A1:
=hyperlink("http://example.com?id="&row())





Ken wrote:

Greetings,

there is a column is number, I want to add a hyperlink to the each
number.
for example,

item A, row 1 is number 1, after the adding the hyperlink to it which
displays 1 but I can click it and link to http://example.com?id=1.
and for row 2, the link will be http://example.com?id=2, and so on.

how to do this?


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
Ken Ken is offline
external usenet poster
 
Posts: 4
Default dynamic hyperlink

but what I want is just edit column a, not column b, I also don't want
to add new items to exist files, just inserting the hyperlink like I
did by clicking the button "insert hyperlink". The problem is I can't
do this row by row because there are more 300 rows.

please help me!

Dave Peterson wrote:
Don't put it in A1.
Put your numbers in column A and put this in B1:

=hyperlink("http://example.com?id="&a1, a1)

(watch your quotes!)

Ken wrote:

thanks, that makes sense, but I still have a problem while I'm trying
to put this in A1,
=hyperlink("http://example.com?id=&a1, a1), I got an error saying excel
can't calculate a formula.
can you help?

Dave Peterson 写道:

You don't even need that other column of numbers.

Put this in A1:
=hyperlink("http://example.com?id="&row())





Ken wrote:

Greetings,

there is a column is number, I want to add a hyperlink to the each
number.
for example,

item A, row 1 is number 1, after the adding the hyperlink to it which
displays 1 but I can click it and link to http://example.com?id=1.
and for row 2, the link will be http://example.com?id=2, and so on.

how to do this?

--

Dave Peterson


--

Dave Peterson


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default dynamic hyperlink

I find that the =hyperlink() version much better behaved than the
insert|Hyperlink version. I'd use the formula by inserting it into an extra
column. Then hide the original column if it bothered me.

But if you want the other hyperlinks, maybe you can use something like this:

Option Explicit
Sub testme()

Dim myRng As Range
Dim myCell As Range
Dim wks As Worksheet
Dim myStr As String

Set wks = Worksheets("sheet1")

myStr = "http://example.com?id="

With wks
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRng.Cells
With myCell
.Hyperlinks.Add anchor:=.Cells, Address:=myStr & .Value
End With
Next myCell

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ken wrote:

but what I want is just edit column a, not column b, I also don't want
to add new items to exist files, just inserting the hyperlink like I
did by clicking the button "insert hyperlink". The problem is I can't
do this row by row because there are more 300 rows.

please help me!

Dave Peterson wrote:
Don't put it in A1.
Put your numbers in column A and put this in B1:

=hyperlink("http://example.com?id="&a1, a1)

(watch your quotes!)

Ken wrote:

thanks, that makes sense, but I still have a problem while I'm trying
to put this in A1,
=hyperlink("http://example.com?id=&a1, a1), I got an error saying excel
can't calculate a formula.
can you help?

Dave Peterson 写道:

You don't even need that other column of numbers.

Put this in A1:
=hyperlink("http://example.com?id="&row())





Ken wrote:

Greetings,

there is a column is number, I want to add a hyperlink to the each
number.
for example,

item A, row 1 is number 1, after the adding the hyperlink to it which
displays 1 but I can click it and link to http://example.com?id=1.
and for row 2, the link will be http://example.com?id=2, and so on.

how to do this?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
Ken Ken is offline
external usenet poster
 
Posts: 4
Default dynamic hyperlink

Thanks, I'm new to the marco, but it works fine, thank you.

Dave Peterson wrote:
I find that the =hyperlink() version much better behaved than the
insert|Hyperlink version. I'd use the formula by inserting it into an extra
column. Then hide the original column if it bothered me.

But if you want the other hyperlinks, maybe you can use something like this:

Option Explicit
Sub testme()

Dim myRng As Range
Dim myCell As Range
Dim wks As Worksheet
Dim myStr As String

Set wks = Worksheets("sheet1")

myStr = "http://example.com?id="

With wks
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRng.Cells
With myCell
.Hyperlinks.Add anchor:=.Cells, Address:=myStr & .Value
End With
Next myCell

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ken wrote:

but what I want is just edit column a, not column b, I also don't want
to add new items to exist files, just inserting the hyperlink like I
did by clicking the button "insert hyperlink". The problem is I can't
do this row by row because there are more 300 rows.

please help me!

Dave Peterson wrote:
Don't put it in A1.
Put your numbers in column A and put this in B1:

=hyperlink("http://example.com?id="&a1, a1)

(watch your quotes!)

Ken wrote:

thanks, that makes sense, but I still have a problem while I'm trying
to put this in A1,
=hyperlink("http://example.com?id=&a1, a1), I got an error saying excel
can't calculate a formula.
can you help?

Dave Peterson 写道:

You don't even need that other column of numbers.

Put this in A1:
=hyperlink("http://example.com?id="&row())





Ken wrote:

Greetings,

there is a column is number, I want to add a hyperlink to the each
number.
for example,

item A, row 1 is number 1, after the adding the hyperlink to it which
displays 1 but I can click it and link to http://example.com?id=1.
and for row 2, the link will be http://example.com?id=2, and so on.

how to do this?

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic hyperlink [email protected] Excel Discussion (Misc queries) 2 August 22nd 06 12:30 PM
Dynamic Hyperlink Larry S Excel Worksheet Functions 5 May 17th 06 12:21 PM
answer to odd results when comparing hyperlink addresses Patricia Shannon Links and Linking in Excel 0 March 9th 06 07:28 PM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
Can I create a dynamic email address in Excels hyperlink? ibrettferguson Excel Worksheet Functions 1 November 8th 04 02:24 AM


All times are GMT +1. The time now is 11:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright 2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"