Hyperlink to run macro does not run

kmht0307

New Member
Joined
Aug 20, 2010
Messages
8
I have the following hyperlink in sheet named 'Process' in cell B34:

Text to Display: CLICK HERE TO PERFORM THE FOLLOWING:
Type the cell reference: B34

The macro code is:

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
If Target.Range.Address = "$B$34" Then
Worksheets("Input Sheet").Select
Columns("C:C").Select
Selection.Replace What:="PLASTIC", Replacement:="PLASTIC/POLYMER", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("C:C").Select
Selection.Replace What:="POLYMER", Replacement:="PLASTIC/POLYMER", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("C:C").Select
Selection.Replace What:="AGGREGATE", Replacement:="AGGREGATES/HARDCORE", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("C:C").Select
Selection.Replace What:="AGGREGATES", Replacement:="AGGREGATES/HARDCORE", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("C:C").Select
Selection.Replace What:="HARDCORE", Replacement:="AGGREGATES/HARDCORE", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("C:C").Select
Selection.Replace What:="NON DOMESTIC", Replacement:="OTHER", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Range("A1").Select
End If
End Sub

When I click on the hyperlink, nothing happens.

I have tried running the following code in the immediate window:

Application.EnableEvents = True

But still nothing happens when I click the hyperlink.

Any ideas?
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Where is the code located?
 
Upvote 0
It is currently located in the Process tab where the hyperlink is, but I did originally have it located in a Module.
 
Upvote 0
In that case you nee to change the first line to
Code:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
 
Upvote 0
Many thanks, I have updated this and it worked a couple of time, but now the link does not seem to do anything again.
 
Upvote 0
Do you get any error messages?
Have you tried running
Code:
Application.EnableEvents = True
in the immediate window again?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top