ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select and Run (https://www.excelbanter.com/excel-programming/399893-select-run.html)

clara

Select and Run
 
I have a workbook with instructions, I would like to make it so that if you
press on a cell that has the topic you're looking for, then you'll be
directed to the text for that topic. How can I do that?

For example:
A1 How to bake - if I click on this cell, then I'd be directed to Sheet2!B1


Thanks.

Chip Pearson

Select and Run
 
I would use a double-click rather than a single click. Right-click the sheet
tab for Sheet1, for example, choose View Code, and paste in the following
code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Select Case Target.Address(False, False)
Case "A1"
Cancel = True
Application.Goto reference:=Worksheets("Sheet2").Range("B1")
Case "A3"
Cancel = True
Application.Goto reference:=Worksheets("Sheet2").Range("B3")
' other Case statements for other cells
End Select
End Sub

If the user double-clicks on A1 or A3, they'll be taken to a range on
Sheet2. Add additioanl Case elements for the various cells.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Clara" wrote in message
...
I have a workbook with instructions, I would like to make it so that if you
press on a cell that has the topic you're looking for, then you'll be
directed to the text for that topic. How can I do that?

For example:
A1 How to bake - if I click on this cell, then I'd be directed to
Sheet2!B1


Thanks.




All times are GMT +1. The time now is 06:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com