如何用键盘将一行移到其他位置?我已经找到了适用于鼠标的指南,但是由于残障,我在使用鼠标时遇到了麻烦。
请注意,我不希望“手动排序”,并且使用额外的“排序顺序”列不是可行的解决方法。我知道Calc的出色排序能力。
我不确定是否可以使用键盘“移动”行,但是使用c&p以及使用键盘插入/删除行应该提供相同的功能:
Insert
菜单;由于剪切和粘贴操作有时很烦人,因此您可以创建一个简单的宏来剪切单元格,然后创建另一个宏来粘贴它们,从而将现有内容向下移动。
这是一个非常简单的代码,可以“移动”选定的单元格:
Option Explicit
Sub CopyAndCut
' ---------------------------------------------------------
' define variables
Dim document as object
Dim dispatcher as Object
Dim oSelections As Object
' ---------------------------------------------------------
' get access to the document and selections (if any)
document = ThisComponent.CurrentController.Frame
oSelections = ThisComponent.getCurrentSelection()
If IsNull(oSelections) Then Exit Sub
' ---------------------------------------------------------
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:Cut", "", 0, Array())
' -------------------------------------------------------------
' Check the width of the selection - if 1024 columns, we assume
' the complete row was selected and should get deleted
If 1024 = oSelections.Columns.getCount() Then
dispatcher.executeDispatch(document, ".uno:DeleteRows", "", 0, Array())
End If
End Sub
Sub InsertWithMoveDown
' ---------------------------------------------------------
' define variables
Dim document as object
Dim dispatcher as object
' ---------------------------------------------------------
' get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
' ---------------------------------------------------------
' Paste contents with "Move Down" option
Dim args1(5) as New com.sun.star.beans.PropertyValue
args1(0).Name = "Flags"
args1(0).Value = "A"
args1(1).Name = "FormulaCommand"
args1(1).Value = 0
args1(2).Name = "SkipEmptyCells"
args1(2).Value = false
args1(3).Name = "Transpose"
args1(3).Value = false
args1(4).Name = "AsLink"
args1(4).Value = false
args1(5).Name = "MoveMode"
args1(5).Value = 0
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args1())
End Sub
Sub InsertWithMoveRight
' ---------------------------------------------------------
' define variables
Dim document as object
Dim dispatcher as object
' ---------------------------------------------------------
' get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
' ---------------------------------------------------------
' Paste contents with "Move Right" option
Dim args1(5) as New com.sun.star.beans.PropertyValue
args1(0).Name = "Flags"
args1(0).Value = "A"
args1(1).Name = "FormulaCommand"
args1(1).Value = 0
args1(2).Name = "SkipEmptyCells"
args1(2).Value = false
args1(3).Name = "Transpose"
args1(3).Value = false
args1(4).Name = "AsLink"
args1(4).Value = false
args1(5).Name = "MoveMode"
args1(5).Value = 1
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args1())
End Sub
复制代码到你的用户库,只是分配后CopyAndCut
到,例如,Alt+ C,InsertWithMoveDown
以便例如,Alt+ V,及InsertWithMoveRight
到,例如,Alt+ R(所有这些快捷键默认为空)。
现在,您可以使用鼠标或键盘选择单元格或行,使用Alt+剪切它们C,移动到目标单元格,然后使用Alt+V或Alt+粘贴它们R。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句