I’m trying to create a macro that cuts groups of 8 cells and does a paste special with a transpose.
The problem I’m having is that sometime the macro will skip pasting a group.
The group that are skipped are also different each time the macro is run.
The problem only seems to occur with large (50+) iteration count.
Here is my loop:
args2(0).Name = "Flags"
args2(0).Value = "A"
args2(1).Name = "FormulaCommand"
args2(1).Value = 0
args2(2).Name = "SkipEmptyCells"
args2(2).Value = false
args2(3).Name = "Transpose"
args2(3).Value = true
args2(4).Name = "AsLink"
args2(4).Value = false
args2(5).Name = "MoveMode"
args2(5).Value = 4
for i = 1 to Iteration step 1
args1(0).Name = "ToPoint"
args1(0).Value = "A" + (8*i-7) + ":A" + (8*i)
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
args1(0).Name = "ToPoint"
args1(0).Value = "B" + i
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args2())
next i
So far the only solution I have found is running the macro multiple times until all the group have been transposed at least once.