On Mon March 6 2006 21:43, + Andrew R wrote:
> [ MODERATED ] ***********************
> I am trying to write a routine in Calc (part of a Macro) to replace the
> numeric contents of one cell with that of anotherr 'if' a certain condition
> is met (If...Then...Endif). The equivalent statements in Excel would be:
>
> =Select (!A1)
> =Copy()
> =Select(!B1)
> =Paste()
> =Cancel.Copy
>
> A simple alternative would be: "B1=A1".
>
> Possible alternatives could be: Move/Assign/Goto/Replace/EQ, etc. Similar
> functions in O.O. seem to have limited functionality and confined to
> textual data.
As you are not subscribed you may not have seen that:
On Tue March 7 2006 05:46, Ross Johnson wrote:
> Hi,
>
> Have you tried recording a macro while you copy&paste by hand and then
> seeing what the recorded macro code looks like?
>
> This is what OOo produces (I assume that the contents of Array() can be
> examined for the 'if' test):
>
> sub Test
> rem
> ----------------------------------------------------------------------
> rem define variables
> dim document as object
> dim dispatcher as object
> rem
> ----------------------------------------------------------------------
> rem get access to the document
> document = ThisComponent.CurrentController.Frame
> dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
>
> rem
> ----------------------------------------------------------------------
> dim args1(0) as new com.sun.star.beans.PropertyValue
> args1(0).Name = "ToPoint"
> args1(0).Value = "$D$9"
>
> dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
>
> rem
> ----------------------------------------------------------------------
> dim args2(0) as new com.sun.star.beans.PropertyValue
> args2(0).Name = "ToPoint"
> args2(0).Value = "$D$9:$D$10"
>
> dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args2())
>
> rem
> ----------------------------------------------------------------------
> dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
>
> rem
> ----------------------------------------------------------------------
> dim args4(0) as new com.sun.star.beans.PropertyValue
> args4(0).Name = "ToPoint"
> args4(0).Value = "$E$9"
>
> dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args4())
>
> rem
> ----------------------------------------------------------------------
> dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
>
>
> end sub
Please reply to [email protected] only.
--
CPH : openoffice.org contributor
Maybe your question has been answered already?
http://user-faq.openoffice.org/#FAQ
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]