Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Hyperlink Cell to Shape on seperate worksheets

I am struggling with this.
Here is my attempt to generate hyperlinks from a Cell (Sheet1) to a Shape
(Sheet5).
Code:
Option Explicit
Dim wksData As Worksheet
Dim wksShps As Worksheet
Dim Shp As Shape
Dim rLook As Range
Dim rFind As Range
Dim shtCell
Dim shtRange
Dim shtLastRow
Dim sBalloon As String

Sub NumberToBalloon()
'Contributing author: shg
'create hyperlink from column D bubble number (sheet1) to balloon shape 
(sheet5) _
  by text value
'Reverse of macro BalloonToNumber (author: shg)

Sheets(1).Activate
Sheets(1).Hyperlinks.Delete

For Each shtCell In shtRange
    If IsNumeric(shtCell) Then
        'msgbox allows stepping thru each cell to visually see if hyperlink _
         is created, then user can stop macro if they want to (for testing)
        For Each Shp In wksShps.Shapes
            If Shp.AutoShapeType = msoShapeOval Then
                Set rFind = shtCell.Find(what:=Shp.TextFrame.Characters.Text)
                If Not rFind Is Nothing Then
                shtCell.Activate
                MsgBox shtCell    'for testing
                    'creates a hyperlink
                    wksData.Hyperlinks.Add Anchor:=shtCell, _
                            Address:="", _
                            SubAddress:=Shp.Name  'creates an invalid 
reference
                End If
            End If
        Next Shp
    End If
'code removed
Next shtCell
End Sub
The above does create a hyperlink, allthough it is invalid. The "Shape"
doesnt seem to have some type of "location" holder when the shape is on top
of another shape (a large image), just a name and the name doesnt aid in
creating a hyperlink or the hyperlink code is simply wrong.

Any hints, tips or examples are welcome.
Cross posted at: (with file attachment)
http://www.excelforum.com/excel-prog...o-a-shape.html
--
Regards

Rick
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Hyperlink Cell to Shape on seperate worksheets

You can accomplish this indirectly. Set the hyperlink to some cell, say B9,
on Sheet5.

Then in Sheet5 include the following Event macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("B9")) Is Nothing Then Exit Sub
Call PickShape
End Sub


and in a standard module something like:

Sub PickShape()
ActiveSheet.Shapes(1).Select
End Sub


Here is the scenario:

1. click on the hyperlink takes us to Sheet5, cell B9
2. getting to cell B9 activates the event macro whick takes us to the shape.

Just remember that the event macro must go the the worksheet code area.
--
Gary''s Student - gsnu201001


"Rick S." wrote:

I am struggling with this.
Here is my attempt to generate hyperlinks from a Cell (Sheet1) to a Shape
(Sheet5).
Code:
 Option Explicit
 Dim wksData As Worksheet
 Dim wksShps As Worksheet
 Dim Shp As Shape
 Dim rLook As Range
 Dim rFind As Range
 Dim shtCell
 Dim shtRange
 Dim shtLastRow
 Dim sBalloon As String
 
 Sub NumberToBalloon()
 'Contributing author: shg
 'create hyperlink from column D bubble number (sheet1) to balloon shape 
 (sheet5) _
   by text value
 'Reverse of macro BalloonToNumber (author: shg)
 
 Sheets(1).Activate
 Sheets(1).Hyperlinks.Delete
 
 For Each shtCell In shtRange
     If IsNumeric(shtCell) Then
         'msgbox allows stepping thru each cell to visually see if hyperlink _
          is created, then user can stop macro if they want to (for testing)
         For Each Shp In wksShps.Shapes
             If Shp.AutoShapeType = msoShapeOval Then
                 Set rFind = shtCell.Find(what:=Shp.TextFrame.Characters.Text)
                 If Not rFind Is Nothing Then
                 shtCell.Activate
                 MsgBox shtCell    'for testing
                     'creates a hyperlink
                     wksData.Hyperlinks.Add Anchor:=shtCell, _
                             Address:="", _
                             SubAddress:=Shp.Name  'creates an invalid 
 reference
                 End If
             End If
         Next Shp
     End If
 'code removed
 Next shtCell
 End Sub

The above does create a hyperlink, allthough it is invalid. The "Shape"
doesnt seem to have some type of "location" holder when the shape is on top
of another shape (a large image), just a name and the name doesnt aid in
creating a hyperlink or the hyperlink code is simply wrong.

Any hints, tips or examples are welcome.
Cross posted at: (with file attachment)
http://www.excelforum.com/excel-prog...o-a-shape.html
--
Regards

Rick

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Hyperlink Cell to Shape on seperate worksheets

Thank you Gary, I will give this a go.
--
Regards

Rick


"Gary''s Student" wrote:

You can accomplish this indirectly. Set the hyperlink to some cell, say B9,
on Sheet5.

Then in Sheet5 include the following Event macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("B9")) Is Nothing Then Exit Sub
Call PickShape
End Sub


and in a standard module something like:

Sub PickShape()
ActiveSheet.Shapes(1).Select
End Sub


Here is the scenario:

1. click on the hyperlink takes us to Sheet5, cell B9
2. getting to cell B9 activates the event macro whick takes us to the shape.

Just remember that the event macro must go the the worksheet code area.
--
Gary''s Student - gsnu201001


"Rick S." wrote:

I am struggling with this.
Here is my attempt to generate hyperlinks from a Cell (Sheet1) to a Shape
(Sheet5).
Code:
  Option Explicit
  Dim wksData As Worksheet
  Dim wksShps As Worksheet
  Dim Shp As Shape
  Dim rLook As Range
  Dim rFind As Range
  Dim shtCell
  Dim shtRange
  Dim shtLastRow
  Dim sBalloon As String
  
  Sub NumberToBalloon()
  'Contributing author: shg
  'create hyperlink from column D bubble number (sheet1) to balloon shape 
  (sheet5) _
    by text value
  'Reverse of macro BalloonToNumber (author: shg)
  
  Sheets(1).Activate
  Sheets(1).Hyperlinks.Delete
  
  For Each shtCell In shtRange
      If IsNumeric(shtCell) Then
          'msgbox allows stepping thru each cell to visually see if hyperlink _
           is created, then user can stop macro if they want to (for testing)
          For Each Shp In wksShps.Shapes
              If Shp.AutoShapeType = msoShapeOval Then
                  Set rFind = shtCell.Find(what:=Shp.TextFrame.Characters.Text)
                  If Not rFind Is Nothing Then
                  shtCell.Activate
                  MsgBox shtCell    'for testing
                      'creates a hyperlink
                      wksData.Hyperlinks.Add Anchor:=shtCell, _
                              Address:="", _
                              SubAddress:=Shp.Name  'creates an invalid 
  reference
                  End If
              End If
          Next Shp
      End If
  'code removed
  Next shtCell
  End Sub
 

The above does create a hyperlink, allthough it is invalid. The "Shape"
doesnt seem to have some type of "location" holder when the shape is on top
of another shape (a large image), just a name and the name doesnt aid in
creating a hyperlink or the hyperlink code is simply wrong.

Any hints, tips or examples are welcome.
Cross posted at: (with file attachment)
http://www.excelforum.com/excel-prog...o-a-shape.html
--
Regards

Rick

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Hyperlink Cell to Shape on seperate worksheets

Your suggestion worked out.
Thanks.
--
Regards

Rick


"Gary''s Student" wrote:

You can accomplish this indirectly. Set the hyperlink to some cell, say B9,
on Sheet5.

Then in Sheet5 include the following Event macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("B9")) Is Nothing Then Exit Sub
Call PickShape
End Sub


and in a standard module something like:

Sub PickShape()
ActiveSheet.Shapes(1).Select
End Sub


Here is the scenario:

1. click on the hyperlink takes us to Sheet5, cell B9
2. getting to cell B9 activates the event macro whick takes us to the shape.

Just remember that the event macro must go the the worksheet code area.
--
Gary''s Student - gsnu201001


"Rick S." wrote:

I am struggling with this.
Here is my attempt to generate hyperlinks from a Cell (Sheet1) to a Shape
(Sheet5).
Code:
  Option Explicit
  Dim wksData As Worksheet
  Dim wksShps As Worksheet
  Dim Shp As Shape
  Dim rLook As Range
  Dim rFind As Range
  Dim shtCell
  Dim shtRange
  Dim shtLastRow
  Dim sBalloon As String
  
  Sub NumberToBalloon()
  'Contributing author: shg
  'create hyperlink from column D bubble number (sheet1) to balloon shape 
  (sheet5) _
    by text value
  'Reverse of macro BalloonToNumber (author: shg)
  
  Sheets(1).Activate
  Sheets(1).Hyperlinks.Delete
  
  For Each shtCell In shtRange
      If IsNumeric(shtCell) Then
          'msgbox allows stepping thru each cell to visually see if hyperlink _
           is created, then user can stop macro if they want to (for testing)
          For Each Shp In wksShps.Shapes
              If Shp.AutoShapeType = msoShapeOval Then
                  Set rFind = shtCell.Find(what:=Shp.TextFrame.Characters.Text)
                  If Not rFind Is Nothing Then
                  shtCell.Activate
                  MsgBox shtCell    'for testing
                      'creates a hyperlink
                      wksData.Hyperlinks.Add Anchor:=shtCell, _
                              Address:="", _
                              SubAddress:=Shp.Name  'creates an invalid 
  reference
                  End If
              End If
          Next Shp
      End If
  'code removed
  Next shtCell
  End Sub
 

The above does create a hyperlink, allthough it is invalid. The "Shape"
doesnt seem to have some type of "location" holder when the shape is on top
of another shape (a large image), just a name and the name doesnt aid in
creating a hyperlink or the hyperlink code is simply wrong.

Any hints, tips or examples are welcome.
Cross posted at: (with file attachment)
http://www.excelforum.com/excel-prog...o-a-shape.html
--
Regards

Rick

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
Show shape on cell select, Hide shape when cell is deselected Max Excel Programming 5 January 27th 10 11:04 AM
How seperate text with comma in a cell into seperate rows geniusideas Excel Programming 3 May 27th 09 08:10 AM
Adding a hyperlink to a shape Rand[_2_] Excel Programming 1 June 10th 06 01:02 AM
How do I seperate data from a pivot into seperate worksheets? Shannon Excel Discussion (Misc queries) 5 August 25th 05 06:07 AM
how do I display a hyperlink in a seperate cell in excel? Jose Excel Discussion (Misc queries) 1 January 12th 05 12:42 AM


All times are GMT +1. The time now is 01:28 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"