Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Position hyperlink in Excel

I'd like to copy a cell value next to hyperlink cell when I click the
hyperlink in Excel. Here is my code and I thought "ActiveCell" will
present the cell contains hyperlink. But it's not, the ActiveCell
points to A1 automatically. How do I point the cell contains
hyperlink? Thank you.

Here is my code:

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal
Target As Hyperlink)

ActiveSheet.Cells(2, 2) = ActiveCell.Offset(0, 1).Value

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Position hyperlink in Excel

Hi
you may put the following macro in your worksheet module (the worksheet
of your hyperlink):

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim source_value
source_value = Target.Parent.Value
Target.parent.offset(0,1).value = source_value
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


QQExcel wrote:
I'd like to copy a cell value next to hyperlink cell when I click the
hyperlink in Excel. Here is my code and I thought "ActiveCell" will
present the cell contains hyperlink. But it's not, the ActiveCell
points to A1 automatically. How do I point the cell contains
hyperlink? Thank you.

Here is my code:

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal
Target As Hyperlink)

ActiveSheet.Cells(2, 2) = ActiveCell.Offset(0, 1).Value

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Position hyperlink in Excel

That's it! Target.parent.vale

Thanks! Frank!!!


"Frank Kabel" wrote in message ...
Hi
you may put the following macro in your worksheet module (the worksheet
of your hyperlink):

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim source_value
source_value = Target.Parent.Value
Target.parent.offset(0,1).value = source_value
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


QQExcel wrote:
I'd like to copy a cell value next to hyperlink cell when I click the
hyperlink in Excel. Here is my code and I thought "ActiveCell" will
present the cell contains hyperlink. But it's not, the ActiveCell
points to A1 automatically. How do I point the cell contains
hyperlink? Thank you.

Here is my code:

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal
Target As Hyperlink)

ActiveSheet.Cells(2, 2) = ActiveCell.Offset(0, 1).Value

End Sub

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
images in excel keep changing position Mike Excel Discussion (Misc queries) 1 October 30th 09 05:05 PM
how do I fix the position of a worksheet in excel? MartyMac Excel Worksheet Functions 1 December 15th 06 06:07 PM
Excel Position Managent mja Excel Discussion (Misc queries) 5 August 11th 06 10:27 PM
Tab list position in Excel RRe Excel Discussion (Misc queries) 1 January 9th 05 12:12 AM
Active Cell Position Using Go To Or Hyperlink Keith Chipman Excel Programming 1 November 19th 03 03:05 PM


All times are GMT +1. The time now is 03:53 PM.

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

About Us

"It's about Microsoft Excel"