![]() |
Worksheet with multiple Hyperlinks and Macros
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. |
All times are GMT +1. The time now is 01:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com