Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign a macro to a hyperlink


I found this whilst trawling the web and I was wondering if there wa
some way to modify the macro (specifically the 'Select Cas
Target.Address'
'Case “$A$1″' area) to run through many rows without having t
create a seperate Case per row (i.e. having 'i' as the number of row
and creating 'Case “$A$i″).

I would be grateful for any thoughts on this matter :)

Cheers.

-"Independent of the hyperlink, put a SelectionChange event in th
worksheet code module. To do this, right click the sheet tab, an
select View Code. In the code module that pops up, select Workshee
from the top left dropdown, which puts the following procedure into th
code module:"-



Code
-------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
You then adjust what’s between the Sub and End Sub to get what you want:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case “$A$1″
‘ carry out action for Cell A1
Case “$A$2″
‘ carry out action for Cell A2
‘ etc.
End Select
End Sub
-------------------

--
Damin
-----------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...fo&userid=2707
View this thread: http://www.excelforum.com/showthread.php?threadid=53720

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Assign a macro to a hyperlink

You question is not clear, but if you want to do something to a cell on the
row selected:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

' just to demonstrate how you could work with
' a cell in the same row as the cell selected
Msgbox cells(target.row,"F").address

End Sub

--
Regards,
Tom Ogilvy

"Daminc" wrote:


I found this whilst trawling the web and I was wondering if there was
some way to modify the macro (specifically the 'Select Case
Target.Address'
'Case €œ$A$1€³' area) to run through many rows without having to
create a seperate Case per row (i.e. having 'i' as the number of rows
and creating 'Case €œ$A$i€³).

I would be grateful for any thoughts on this matter :)

Cheers.

-"Independent of the hyperlink, put a SelectionChange event in the
worksheet code module. To do this, right click the sheet tab, and
select View Code. In the code module that pops up, select Worksheet
from the top left dropdown, which puts the following procedure into the
code module:"-



Code:
--------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
You then adjust whats between the Sub and End Sub to get what you want:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case €œ$A$1€³
€˜ carry out action for Cell A1
Case €œ$A$2€³
€˜ carry out action for Cell A2
€˜ etc.
End Select
End Sub
--------------------


--
Daminc
------------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074
View this thread: http://www.excelforum.com/showthread...hreadid=537207


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign a macro to a hyperlink


Cheers for your reply Tom.

I'm away until Tuesday and I'm going to take a closer look at this
procedure them.


--
Daminc
------------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074
View this thread: http://www.excelforum.com/showthread...hreadid=537207

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign a macro to a hyperlink


Hi Tom, back again :)

I've tried that macro you posted and I see where you're coming from.

To make my original post a little clearer:

I'm planning to create a hyperlink to a name on a worksheet that, when
clicked, will bring up contact details or a graph dipiciting recorde
statistics etc depending which will be most required by the person ho
will use this application

--
Damin
-----------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...fo&userid=2707
View this thread: http://www.excelforum.com/showthread.php?threadid=53720

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign a macro to a hyperlink


Code
-------------------
If Not Application.Intersect(Target, Range("b1:b10")) _
Is Nothing Then

-------------------


Could you clarify this bit of code for me please. I have very littl
information on using 'Intersect'.

Cheers :

--
Damin
-----------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...fo&userid=2707
View this thread: http://www.excelforum.com/showthread.php?threadid=53720



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Assign a macro to a hyperlink


I've got this little bit of code working:

Code
-------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim numRows As Variant
Dim tRow As Variant

numRows = ActiveSheet.UsedRange.Rows.Count

tRow = Target.Row

Select Case Target.Address(numRows)
Case "$A$" & tRow
MsgBox "Date approved was " & ActiveCell(1, 3)

End Select
End Su
-------------------


I know it's really simple but I think I can now modify it to displa
calculations derived from other sheets.

Thanks Tom for showing me a way forward :

--
Damin
-----------------------------------------------------------------------
Daminc's Profile: http://www.excelforum.com/member.php...fo&userid=2707
View this thread: http://www.excelforum.com/showthread.php?threadid=53720

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
Assign a macro to a hyperlink Daminc[_66_] Excel Programming 0 April 28th 06 03:04 PM
Assign hyperlink to new commandbar control mabond Excel Programming 3 August 22nd 05 02:33 PM
how to Assign Hyperlink to Button in Spreadsheet Warren Deeker Excel Discussion (Misc queries) 1 June 9th 05 02:05 PM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM
Macro to Copy Hyperlink to another file as a HYPERLINK, not text... dollardoc Excel Programming 1 April 7th 05 12:47 AM


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