Macro problem

Hi

I'm writing a book on using spreadsheets for computer modeling, and on my
last model I've ran into a slight problem. Libreoffice calc is doing
something new. I'm using macro's to update the time step by simply copying
the new information over the old information. For example, imagine having a
number in cell A1 and then in cell B1 you type "=A1 + 1". Then you copy and
paste (special with number only) the number from B1 to A1, such that A1 is
now 1 more than it was to start with and B1 is now double the original A1.
I can keep running the macro and continually count upwards. I create a
button that when pressed runs the macro. However, whereas before pressing
the button repeatedly always worked, now I have to press the button and
then click elsewhere on the spreadsheet and then press the button again.

Wondering if I'm missing anything obvious?

Thanks

Gavin

Nope, probably not missing something obvious :slight_smile:

Are you using dispatch messages?

What happens if you change the macro to do something like this:

   Dim oSheet
   oSheet = ThisComponent.Sheets(0)
   oSheet.getCellByPosition(0, 0).setValue(oSheet.getCellByPosition(1, 0).getValue())

Note, cell (0,0) is A1 and (1,0) is B1.

My guess is that the problem goes away. I think that it is related to what has the focus and how you issue the dispatch.