Macros 在open office Calc中创建如果为空的粘贴宏

Macros 在open office Calc中创建如果为空的粘贴宏,macros,openoffice-calc,openoffice-basic,Macros,Openoffice Calc,Openoffice Basic,我正在尝试在OpenOffice中创建宏,但是我找不到执行此操作的方法。我想复制一个特定的单元格,并在给定的列上复制过去的空白值 基本上是这样的 Copy "B2" If "A1" blank paste if false move 1 cell lower end if 类似这样的事情,我花了很多时间绘制流程图,并试图使编程正确,但我只是在这个问题上崩溃了。我非常感谢任何能找到正确答案的回复或指导,谢谢。有人刚刚在aoo论坛上给了我答案thank Through=COUNTA(Sheet2.

我正在尝试在OpenOffice中创建宏,但是我找不到执行此操作的方法。我想复制一个特定的单元格,并在给定的列上复制过去的空白值

基本上是这样的

Copy "B2"
If "A1" blank paste
if false
move 1 cell lower
end if

类似这样的事情,我花了很多时间绘制流程图,并试图使编程正确,但我只是在这个问题上崩溃了。我非常感谢任何能找到正确答案的回复或指导,谢谢。

有人刚刚在aoo论坛上给了我答案thank Through=COUNTA(Sheet2.A1:A2)

最小化

sub Minimizer()

   dim document   as object
   dim dispatcher as object

   document   = ThisComponent.CurrentController.Frame
   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

   dim args1(0) as new com.sun.star.beans.PropertyValue
   args1(0).Name = "ToPoint"
   args1(0).Value = "$D$10:$E$12"  ' select what is to be copied

   dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())


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


   dim args3(0) as new com.sun.star.beans.PropertyValue
   args3(0).Name = "ToPoint"
   args3(0).Value = "$C$10"    ' select where i will be paste

   dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
   dispatcher.executeDispatch(document, ".uno:SetInputMode", "", 0, Array())

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


   dim args5(0) as new com.sun.star.beans.PropertyValue
   args5(0).Name = "ToPoint"
   args5(0).Value = "$D$9"

   dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args5())

end sub
--あなたの若さをだれにも見下げられることのないようにしなさい

“向下移动一个单元格”
如果为空,是否粘贴?您只是想将
B2
复制到
A列中下一个未使用的单元格中吗?
Sub PutNowInCurrentCell
   Dim oDoc As Object
   Dim oSel As Object
   Dim svc as Object

   svc = createUnoService( "com.sun.star.sheet.FunctionAccess" )  'Create a service to use Calc functions

   oDoc = ThisComponent
   oSel = oDoc.getCurrentSelection()
   if oSel.supportsService("com.sun.star.sheet.SheetCell") then
      oSel.NumberFormat = getFormat("HH:MM:SS AM/PM")
      oSel.Value =  svc.callFunction("NOW",Array())
   endif

End Sub

Function getformat(f As String) As Long
   Dim oDoc As Object
   Dim NumberFormats As Object
   Dim Loc as New com.sun.star.lang.Locale
   Dim formatID As Long

   oDoc = ThisComponent

   Loc = oDoc.CharLocale

   NumberFormats = oDoc.NumberFormats

   formatId = NumberFormats.queryKey(f, Loc, False)
   If formatId = -1 Then
      formatId = NumberFormats.addNew(f, Loc)
   End If

   getformat  = formatID

End Function
sub Minimizer()

   dim document   as object
   dim dispatcher as object

   document   = ThisComponent.CurrentController.Frame
   dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

   dim args1(0) as new com.sun.star.beans.PropertyValue
   args1(0).Name = "ToPoint"
   args1(0).Value = "$D$10:$E$12"  ' select what is to be copied

   dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())


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


   dim args3(0) as new com.sun.star.beans.PropertyValue
   args3(0).Name = "ToPoint"
   args3(0).Value = "$C$10"    ' select where i will be paste

   dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
   dispatcher.executeDispatch(document, ".uno:SetInputMode", "", 0, Array())

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


   dim args5(0) as new com.sun.star.beans.PropertyValue
   args5(0).Name = "ToPoint"
   args5(0).Value = "$D$9"

   dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args5())

end sub