Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good Day All,
I need help with preparing a macro for each hyperlink in my worksheet. I have an org chart that I created hyperlinks for each department. I have approximately 40 departments. I want to be able to click on the hyperlink that will run a macro. I want the macro to populate a fixed cell in the worksheet with the department name I assign to the hyperlink. My dilemma now is that I do not know how to distinguish a macro for each hyperlink. I am using the following code I copied from a previous message: Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink) If Not Intersect(Target.Parent, Range("B5")) Is Nothing Then ActiveSheet.PageSetup.CenterHeader = "&""Arial,Bold""2006 Expense Variance Report for Sales" Worksheets("Expense Report").Select Range("AA5").Select ActiveCell.FormulaR1C1 = "Sales" Calculate Worksheets("Expense Report").Select Range("K3").Select End If End Sub AA5 is the fix cell I want to populate with the department name each time I click on a hyperlink. Each hyperlink will have a different PageHeader and ActiveCell FormulaR1C1. Thank you very much. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
hyperlinks and macros | Excel Discussion (Misc queries) | |||
Hyperlinks & macros | Links and Linking in Excel | |||
Hyperlinks & macros | Excel Discussion (Misc queries) | |||
change multiple hyperlinks in worksheet | Links and Linking in Excel | |||
Using Multiple Tests and Sounds With Worksheet Macros | Excel Discussion (Misc queries) |