<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_UNCONFIRMED "
   title="UNCONFIRMED - BUTTON WITH MACRO IN CALC HAS TO BE PUSHED TWICE TO DO ALL THE WORK."
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=131317">131317</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>BUTTON WITH MACRO IN CALC HAS TO BE PUSHED TWICE TO DO ALL THE WORK.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.4.1.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows (All)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>UNCONFIRMED
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Calc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>libreoffice-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>romrodz77@outlook.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
If I run a macro via a button, I have to press it 2 or more times to get all
the macro done. If you do it via the macro editor, it works flawlessly.
I have attached a .ods with an example.

It deletes the cell value on some columns and then pastes the value from the
"master" colum. The first time you press the button, it just deletes
everything. The second or third time, it normally finishes the work.

Steps to Reproduce:
1. Open the attachment
2. Push the button. Everything will be deleted as it should.
3. Push the button another time (or more). It pastes the numbers as it should
4. Repeat it via the macro editor. It works from the firs time.

Actual Results:
After pushing the button once, it deletes the values in the columns with a pink
cell above.
After the second or third time, you see that it pastes the value from the "DA"
column.

Expected Results:
After pushing the button 1, it should have deleted the values and restore them.

Running the macro via the macro editor works just fine.


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
It may be related to this bug:
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "uno: copy" via the dispatcher does not work when a button has focus"
   href="show_bug.cgi?id=70883">https://bugs.documentfoundation.org/show_bug.cgi?id=70883</a>
The first line of the macro is the "workaround" suggested in this bug report.

Also, if you clic on a random cell after pushing the button you may have the
expected result from the first time.

Versión: 6.4.1.2 (x64)
Id. de compilación: 4d224e95b98b138af42a64d84056446d09082932
Subprocs. CPU: 8; SO: Windows 10.0 Build 18363; Repres. IU: GL; VCL: win; 
Configuración regional: es-ES (es_ES); Idioma de IU: es-ES
Calc: CL</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>