Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom,
That was exactly what i was looking for. You're the best. Greets, Peter "Tom Ogilvy" schreef in bericht ... Just use the selectionchange event to record (update a static variable) the last activecell (it already tells you the cell selected). Test if the last active cell was one of the ones you are interested in, and if so, then change the selection to the next cell you want selected. Make sure you disable events so you don't go into an endless loop. so as an example, right click on the sheet tab and select view code. Put in code like this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) Static oldCell As Range If Not oldCell Is Nothing Then Debug.Print oldCell.Address Select Case oldCell.Address(0, 0) 'A1 = G5 = E3 = K10 = F2 Case "A1": sStr = "G5" Case "G5": sStr = "E3" Case "E3": sStr = "K10" Case "K10": sStr = "F2" Case "F2": sStr = "A1" Case Else: sStr = "" End Select If sStr < "" Then Application.EnableEvents = False Range(sStr).Select Application.EnableEvents = True End If End If Set oldCell = ActiveCell End Sub -- Regards, Tom Ogilvy "Peter" wrote in message ... Hi again Tom, That was something i knew, but it is not what i meant. I'm going to try to give you an example of what i want. in a vba code: A1 = G5 = E3 = K10 = F2 when A1 is selected and enter is hit move to cell G5 when E3 is selected and enter is hit move to cell K10 when................and so on The starting cell is a single selected cell, the end cel is the next cell that has been written in the code. I don't want all the cells selected at the same time, i'm just looking for a taborder to move from one cell to another. Regards, Peter "Tom Ogilvy" schreef in bericht ... Just to clarify. Use the mouse and the control key to select the cells in the order you want to nagivate through them (so that all the cells of interest are selected). then leave them selected. Now use the enter/return key to travel through them. -- Regards, Tom Ogilvy "Peter" wrote in message ... No, the activecell is specified. It's like the textbox- taborder in a userform, you know what i mean? "Tom Ogilvy" schreef in bericht ... No matter where the activecell is, if the user hits enter, you want to go to G4? -- Regards, Tom Ogilvy "Peter" wrote in message ... Hi, Is it possible that, when you hit the enter button, the cursor moves to a cell specified by me? For instance: A1 =="enter" ==G4 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
move cursor on one sheet moves cursor on all sheets | Excel Discussion (Misc queries) | |||
Move cursor to next row | Excel Discussion (Misc queries) | |||
Move Cursor to A1 | Excel Discussion (Misc queries) | |||
macro to move cursor | Excel Programming | |||
HOW TO MOVE CURSOR | Excel Programming |