On Mon, 2006-03-06 at 16:43 -0500, Andrew R wrote:
> 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".
>
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]