[calc] automatically jump to cell?

I don’t expect it to be possible, however I will ask the question and who knows …

Let’s say I create a spreadsheet consisting of 2 columns. In the first cell of each row I type some text, and in the second cell I insert the date by pressing a shortcut. After inserting the date by using the keyboard shortcut, I have to press TAB to go to the next cell. Since I’ve protected all of the cells, except the ones in the 2 columns, my cursor automatically moves to the first cell of the next row.

Now, I wonder … would it be possible to have the cursor automatically move to the next row WITHOUT having to press TAB first? Or is something like that an illusion?

So first i type some text in cell A1. Then I enter the date in B1 by pressing the shortcut, and after the date is inserted the cursor automatically moves to A2. In all fairness, I don’t expect this to be possible … but maybe someone can confirm this … or not???

Not sure I understand what you mean …

Hi - you can record a macro like this:

sub DateJump

dim document   as object
dim dispatcher as object
dim args(1) as new com.sun.star.beans.PropertyValue

args(0).Name = "By"
args(0).Value = 1
args(1).Name = "Sel"
args(1).Value = false


document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args())
dispatcher.executeDispatch(document, ".uno:InsertCurrentDate", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args())
dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args())

end sub

Customize keyboard to assign the macro to your shorcut and use the shortcut to validate data entry in A

jump.ods

[EDIT]

I edit my answer to be able to join a new version of the Jump.ods

Run DateJump macro in one of the “date” cols (sheet1 or sheet2).

Thanks. Would be an option. Problem is that I only want the action to occur if I’m standing in the last cell, and not when I’m inserting a date in another cell. Also it would be easier if the cursor simply went to the first cell in the next row, instead of going one down and one left. In real-life my sheets do have more than 2 colums, and this differs per sheet so it’s not a very flexible solution. I hoped there would be an easier way, but I’m afraid I’ll just have to press TAB then (lazy me).

use .uno:GoLeftToStartOfData instead .uno:GoLeft

Thanks, however the problem is that it should only do this in the last cell, and not if I insert a date anywhere else :-/

When inserting a date anywhere else, just use the default shortcut CTRL+; (locale FR at least)
Use “your” shortcut for the last cell. You can also simplify the macro:

dispatcher.executeDispatch(document, ".uno:InsertCurrentDate", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:JumpToNextUnprotected", "", 0, Array())

This starts to look good! Thanks for your help so far! But where do I put this code in the macro? Could you perhaps show the full macro? And what do the args like args(0).Name = “By” and args(1).Name = “Sel” mean by the way?

This starts to look good! Thanks for your help so far! But where do I put this code in the macro? Could you perhaps show the full macro? And what do the args like args(0).Name = “By” and args(1).Name = “Sel” mean by the way?

I join a new version in my first answer. To understand By 1 Sel, just try for instance GoRight with By 2 Sel True, You move for instance from A1 to C1 (2 cells) and select them.

Thanks, the updated version seems to be exactly what I needed. Thanks a lot!

I think it can be done, from the first cell to enter data select the range where you want introduce data, and enter data with [<┘].

Maybe an image can help.

image description

Haha, sorry …still not getting what you are trying to do here …

I think that Mario proposes is: If a range is selected before entering data going to the next cell remains in the selected range, if you use Enter, Tab and Shift +Tab to move to the next. This is most useful when the cells are not protected which is not your case

Thanks, now I understand. But indeed this is not what I needed.