Triggering vba from a cell contents

PJS Soft

New Member
Joined
Aug 25, 2011
Messages
4
Hi,

This may be an easy one but it's just not standing out to me.
I have a Data List on a sheet (the log) that stores all the info inputted from a user form.
The data can then be viewed as a printable layout on another sheet using a macro to ask for the reference number then copy all the data across.

I have that side of things working however what I'd really like to do is make the reference number in Column A on the log a hyperlink that when clicked triggers the same macro but doesn't ask for the reference number because it uses which ever reference was clicked on.

Any ideas?

Thanks in advance
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
you can either look at
Worksheet_SelectionChange if you're working a single sheet
or
Workbook_SheetSelectionChange if there are multiple sheets to trigger from


Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If _
        Target.Column = 1 And _
        Target.Cells.Count = 1 Then
 
        Call YourSpecialRoutine_Here(Target.Whatever)
    End If
End Sub

Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
 
    If _
        Sh.Name = "your Special Sheet Name Here" And _
        Target.Column = 1 And _
        Target.Cells.Count = 1 Then
 
        Call YourSpecialRoutine_Here(Target.Whatever)
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,280
Members
452,902
Latest member
Knuddeluff

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