ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   automatically go to a cell (excel) (https://www.excelbanter.com/excel-discussion-misc-queries/132580-automatically-go-cell-excel.html)

chbelair

automatically go to a cell (excel)
 
For example, if cell a1 = b100, I would like to be able to double click on A1
and automatically go to cell b100.

Don Guillett

automatically go to a cell (excel)
 
right click sheet tabview codeinsert this. Now if b100 is typed into the
active cell and you double click you will go there.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Range(Target).Select
End Sub


--
Don Guillett
SalesAid Software

"chbelair" wrote in message
...
For example, if cell a1 = b100, I would like to be able to double click on
A1
and automatically go to cell b100.




Gord Dibben

automatically go to a cell (excel)
 
You mean if the value of A1 is same as value of B100 or if A1 contains the
formula =B100 ?

If the latter, go to ToolsOptionsEdit and uncheck "edit directly in cell"

If the former you would need doubleclick event code.

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
On Error GoTo enditall
Application.EnableEvents = False
If Not Intersect(Target, Range("A1")) Is Nothing Then
If Target.Value = Range("B100").Value Then
Range("B100").Select
End If
End If
enditall:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste the above into that sheet module.


Gord Dibben MS Excel MVP

On Tue, 27 Feb 2007 13:58:45 -0800, chbelair
wrote:

For example, if cell a1 = b100, I would like to be able to double click on A1
and automatically go to cell b100.




All times are GMT +1. The time now is 12:48 AM.

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