Ask Your Question
0

[calc] automatically jump to cell?

asked 2015-04-20 16:23:23 +0200

LibreGuy gravatar image

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???

edit retag flag offensive close merge delete

Comments

Not sure I understand what you mean ...

LibreGuy gravatar imageLibreGuy ( 2015-04-20 18:25:08 +0200 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2015-04-20 17:08:25 +0200

pierre-yves samyn gravatar image

updated 2015-04-20 22:16:33 +0200

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).

edit flag offensive delete link more

Comments

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).

LibreGuy gravatar imageLibreGuy ( 2015-04-20 17:38:23 +0200 )edit

use .uno:GoLeftToStartOfData instead .uno:GoLeft

karolus gravatar imagekarolus ( 2015-04-20 17:54:16 +0200 )edit

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

LibreGuy gravatar imageLibreGuy ( 2015-04-20 18:24:28 +0200 )edit

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())
pierre-yves samyn gravatar imagepierre-yves samyn ( 2015-04-20 21:18:53 +0200 )edit

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?

LibreGuy gravatar imageLibreGuy ( 2015-04-20 21:45:14 +0200 )edit

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.

pierre-yves samyn gravatar imagepierre-yves samyn ( 2015-04-20 22:22:29 +0200 )edit

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

LibreGuy gravatar imageLibreGuy ( 2015-04-20 22:26:23 +0200 )edit
0

answered 2015-04-20 18:00:42 +0200

m.a.riosv gravatar image

updated 2015-04-20 20:12:36 +0200

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

edit flag offensive delete link more

Comments

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

LibreGuy gravatar imageLibreGuy ( 2015-04-20 21:42:24 +0200 )edit

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

pierre-yves samyn gravatar imagepierre-yves samyn ( 2015-04-20 22:36:10 +0200 )edit

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

LibreGuy gravatar imageLibreGuy ( 2015-04-20 22:42:55 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-04-20 16:23:23 +0200

Seen: 1,854 times

Last updated: Apr 20 '15