ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Fire event code with Hyperlink and copy/paste RadioButtons (https://www.excelbanter.com/excel-programming/442361-fire-event-code-hyperlink-copy-paste-radiobuttons.html)

ryguy7272

Fire event code with Hyperlink and copy/paste RadioButtons
 
2-part question:
#1) How do I fire event code by clicking a hyperlink? I dont want to go
to a web site; just want to run a macro. Im just looking for a way to click
a hyperlink and fire some code. Spent a bit of time searching online for a
solution but didnt see anything.
#2) How do I copy/paste objects, such as radio buttons and some check
boxes, from a row above my active row, insert a row, and paste the objects
there?

Heres the code that Im fiddling with now:
Private Sub worksheet_selectionChange(ByVal Target As Range)
If Target.Address = "$A$15" Then
ActiveCell.Offset(1, 0).EntireRow.Insert
ActiveCell.Offset(-1, 0).EntireRow.Copy
Rows(ActiveCell.Row).PasteSpecial
End If
End Sub

The Hyperlink part isnt working and the copy/paste objects part isnt
working.
Appreciate any help with this!
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

JLGWhiz[_2_]

Fire event code with Hyperlink and copy/paste RadioButtons
 
You could probably use the worksheet_deactivate even for the hperlink thing.
The controls are positioned based on top and left parameters. You would
probably need to use the move method to reposition them and I suspect you
would have to save the file to make them stay where you put them.



"ryguy7272" wrote in message
...
2-part question:
#1) How do I fire event code by clicking a hyperlink? I don't want to go
to a web site; just want to run a macro. I'm just looking for a way to
click
a hyperlink and fire some code. Spent a bit of time searching online for
a
solution but didn't see anything.
#2) How do I copy/paste objects, such as radio buttons and some check
boxes, from a row above my active row, insert a row, and paste the objects
there?

Here's the code that I'm fiddling with now:
Private Sub worksheet_selectionChange(ByVal Target As Range)
If Target.Address = "$A$15" Then
ActiveCell.Offset(1, 0).EntireRow.Insert
ActiveCell.Offset(-1, 0).EntireRow.Copy
Rows(ActiveCell.Row).PasteSpecial
End If
End Sub

The Hyperlink part isn't working and the copy/paste objects part isn't
working.
Appreciate any help with this!
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.




Tom Hutchins

Fire event code with Hyperlink and copy/paste RadioButtons
 
Regarding question #1, there are several events you can use that occur when a
hyperlink is clicked in Excel:
Application.SheetFollowHyperlink
Workbook_SheetFollowHyperlink
Worksheet_FollowHyperlink
However, as far as I can tell, these events happen AFTER the hyperlink is
executed.

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, _
ByVal Target As Hyperlink)
MsgBox "Clicked a link on " & ActiveSheet.Name
End Sub

If a cell on Sheet1 has a hyperlink to Sheet3, the msgbox above will list
Sheet3, not Sheet1. You can edit the hyperlink to point to itself (the cell
containing it) as a means to not go anywhere but still call the event code.

Hope this helps,

Hutch

"ryguy7272" wrote:

2-part question:
#1) How do I fire event code by clicking a hyperlink? I dont want to go
to a web site; just want to run a macro. Im just looking for a way to click
a hyperlink and fire some code. Spent a bit of time searching online for a
solution but didnt see anything.
#2) How do I copy/paste objects, such as radio buttons and some check
boxes, from a row above my active row, insert a row, and paste the objects
there?

Heres the code that Im fiddling with now:
Private Sub worksheet_selectionChange(ByVal Target As Range)
If Target.Address = "$A$15" Then
ActiveCell.Offset(1, 0).EntireRow.Insert
ActiveCell.Offset(-1, 0).EntireRow.Copy
Rows(ActiveCell.Row).PasteSpecial
End If
End Sub

The Hyperlink part isnt working and the copy/paste objects part isnt
working.
Appreciate any help with this!
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


ryguy7272

Fire event code with Hyperlink and copy/paste RadioButtons
 
Thanks everyone!!

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Tom Hutchins" wrote:

Regarding question #1, there are several events you can use that occur when a
hyperlink is clicked in Excel:
Application.SheetFollowHyperlink
Workbook_SheetFollowHyperlink
Worksheet_FollowHyperlink
However, as far as I can tell, these events happen AFTER the hyperlink is
executed.

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, _
ByVal Target As Hyperlink)
MsgBox "Clicked a link on " & ActiveSheet.Name
End Sub

If a cell on Sheet1 has a hyperlink to Sheet3, the msgbox above will list
Sheet3, not Sheet1. You can edit the hyperlink to point to itself (the cell
containing it) as a means to not go anywhere but still call the event code.

Hope this helps,

Hutch

"ryguy7272" wrote:

2-part question:
#1) How do I fire event code by clicking a hyperlink? I dont want to go
to a web site; just want to run a macro. Im just looking for a way to click
a hyperlink and fire some code. Spent a bit of time searching online for a
solution but didnt see anything.
#2) How do I copy/paste objects, such as radio buttons and some check
boxes, from a row above my active row, insert a row, and paste the objects
there?

Heres the code that Im fiddling with now:
Private Sub worksheet_selectionChange(ByVal Target As Range)
If Target.Address = "$A$15" Then
ActiveCell.Offset(1, 0).EntireRow.Insert
ActiveCell.Offset(-1, 0).EntireRow.Copy
Rows(ActiveCell.Row).PasteSpecial
End If
End Sub

The Hyperlink part isnt working and the copy/paste objects part isnt
working.
Appreciate any help with this!
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com