Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default create hyperlink cell in excel using VB

I have created a summary sheet from cells in other sheets. I have also
included the sheet name in a cell on each row of data in the summary (extract
below). Does any one know how I can make the Cell with the sheet name a
hyperlink to that sheet using Visual Basic?

Greatful for any help!

For Each sh In Worksheets

If Left(sh.Name, 4) = "TEST" Then ' Only use those where the worksheet
name starts with TEST
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) = sh.Name
CellLetterTo = CellLetterTo + 1
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) =
sh.Range(TestDescription).Value
CellLetterTo = CellLetterTo + 1 etc
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default create hyperlink cell in excel using VB

With Worksheets("Summary")
.Cells(CellnumberTo, CellLetterTo).Value = sh.Name
.Hyperlinks.Add anchor:=.Cells(CellnumberTo, CellLetterTo), Address:="", _
SubAddress:="'" & sh.Name & "'!A1"
End With
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




"Haldane"
wrote in message
I have created a summary sheet from cells in other sheets. I have also
included the sheet name in a cell on each row of data in the summary (extract
below). Does any one know how I can make the Cell with the sheet name a
hyperlink to that sheet using Visual Basic?
Greatful for any help!

For Each sh In Worksheets

If Left(sh.Name, 4) = "TEST" Then ' Only use those where the worksheet
name starts with TEST
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) = sh.Name
CellLetterTo = CellLetterTo + 1
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) =
sh.Range(TestDescription).Value
CellLetterTo = CellLetterTo + 1 etc
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default create hyperlink cell in excel using VB

Something like this:

Sub Hyp_Add()
Dim sh As Worksheet
Dim CellnumberTo As Long
Dim CellLetterTo As Integer

For Each sh In Worksheets
If Left(sh.Name, 4) = "TEST" Then ' Only use those where the worksheet
'name starts with TEST
Worksheets("Summary").Hyperlinks.Add Anchor:= _
Cells(CellnumberTo, CellLetterTo), Address:="", _
SubAddress:=sh.Name & "!A1", _
TextToDisplay:=sh.Name

CellLetterTo = CellLetterTo + 1
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) = _
sh.Range(TestDescription).Value
CellLetterTo = CellLetterTo + 1 'etc
End If
Next
End Sub


Mike F
"Haldane" wrote in message
...
I have created a summary sheet from cells in other sheets. I have also
included the sheet name in a cell on each row of data in the summary
(extract
below). Does any one know how I can make the Cell with the sheet name a
hyperlink to that sheet using Visual Basic?

Greatful for any help!

For Each sh In Worksheets

If Left(sh.Name, 4) = "TEST" Then ' Only use those where the worksheet
name starts with TEST
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) = sh.Name
CellLetterTo = CellLetterTo + 1
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) =
sh.Range(TestDescription).Value
CellLetterTo = CellLetterTo + 1 etc



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default create hyperlink cell in excel using VB

Thanks Jim that worked first time -

"Jim Cone" wrote:

With Worksheets("Summary")
.Cells(CellnumberTo, CellLetterTo).Value = sh.Name
.Hyperlinks.Add anchor:=.Cells(CellnumberTo, CellLetterTo), Address:="", _
SubAddress:="'" & sh.Name & "'!A1"
End With
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




"Haldane"
wrote in message
I have created a summary sheet from cells in other sheets. I have also
included the sheet name in a cell on each row of data in the summary (extract
below). Does any one know how I can make the Cell with the sheet name a
hyperlink to that sheet using Visual Basic?
Greatful for any help!

For Each sh In Worksheets

If Left(sh.Name, 4) = "TEST" Then ' Only use those where the worksheet
name starts with TEST
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) = sh.Name
CellLetterTo = CellLetterTo + 1
Worksheets("Summary").Cells(CellnumberTo, CellLetterTo) =
sh.Range(TestDescription).Value
CellLetterTo = CellLetterTo + 1 etc

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
Create HTML code for a hyperlink from cell contents Billy_McSkintos Excel Worksheet Functions 1 January 26th 11 04:20 AM
Create an hyperlink automatically in a cell João Carlos Excel Discussion (Misc queries) 2 August 1st 09 10:14 AM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
Create a hyperlink with querystring from cell Marc Miller Excel Programming 2 April 28th 05 08:58 PM
How to create a hyperlink in excel, using the text in a cell. Leo Excel Worksheet Functions 1 January 29th 05 04:32 AM


All times are GMT +1. The time now is 04:52 AM.

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"