With Macro PHP, is it possible to mix 2 functions in one control button

    With Macro PHP, is it possible to mix 2 functions in one control button

    Hello palodaters,

    sorry for my question, but i'm a complete newbie to Php programming function.

    My own is very simple, I would like put in a celle "2" and 1 sec later (or two or three, never mind) "1". This with only one control button.
    See below my Php Macro :

    With this, I need two buttons : one for function Hide and another for function Unhide.
    I have tried to put a function sleep (1s), but it didn't work.

    So, How I can "mix" the functions to have a single control button ?

    Any hint is appreciable.
    Sorry for bad English.

    Thanks in advance, have a nice day.

    Post was edited 1 time, last by “belgarion” ().

    I'm not the best with the macro language, but you can only assign (I believe) 1 function to a button. You would need to combine the 2 functions (Hide & unhide) into 1.

    I'm not familiar with using a sleep/stall command in PHP ( I assume you want something to "blink") However for a single hide/unhide toggle you could run something like (in correct PHP format):

    IF $range = 1
    $range -> value = 2
    else
    $range -> value = 1
    Firstly, thanks you for reply zprs34 !

    zprs34 wrote:

    IF $range = 1
    $range -> value = 2
    else
    $range -> value = 1


    I think its a potential solution, but, I have tried your solution and another (see below) but it didn't work.
    function hide()
    {
    if(
    $range = activesheet()->range('f1');
    $range->value=1;

    else(
    $range = activesheet()->range('f1');
    $range->value=2;)
    }

    Someone have another idea ;) ?
    Thanks zprs34,

    I have tried your macro, but it's not my own. The cell became "1" but I can't put 2 after for have a rotation.

    zprs34 wrote:

    you can only assign (I believe) 1 function to a button.

    Like you said before, my demand is not possible. I saw "Laloune" confirm this fact in another thread.
    I will use 2 two control buttons.

    Regards,
    Bel.

    Post was edited 1 time, last by “belgarion” ().