Hey all. I have a column of values from C4:C42. Each value in each cell is the name of another worksheet in the workbook. when you double click the cell - it unhides the corresponding worksheet. I have been successful in coding each cell individually - but I am hoping there is an easier way to do this. Here's what I got:
Is there an easier way than having to do this all the way to C42? All help is appreciated.'private sub will call the spreadsheet of the cost center when double clicked Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Application.ScreenUpdating = False Dim CostC As String If Selection.Count = 1 Then 'BEGIN Cost Center Assignments If Not Intersect(Target, Range("c4")) Is Nothing Then CostC = ThisWorkbook.Sheets("RevenueALL").Range("C4").Value + "_S" ThisWorkbook.Sheets(CostC).Visible = True ThisWorkbook.Sheets(CostC).Activate ElseIf Not Intersect(Target, Range("c5")) Is Nothing Then CostC = ThisWorkbook.Sheets("RevenueALL").Range("C5").Value + "_S" ThisWorkbook.Sheets(CostC).Visible = True ThisWorkbook.Sheets(CostC).Activate 'elseif End sub()
Thanks
J
Bookmarks