Posts by sachin123sood

    Hi


    I want to achieve the same thing as with the pause statement and then we press F5 for continuing from the same point.


    The additional thing here I require is I will pause a macro or a proc at a certain line ( whenever stop button is pressed ) and then will execute some other proc ( get a notification when it will finish ) and after that will resume the operation1 from the same point where it was stopped .


    The code will be similarly be something like this


    'this is button1 to start operation 1


    sub commandbutton1_click()


    operation1


    end sub


    'this code is for operation 1


    sub operation1()


    'some statements to execute
    --------
    --------------
    ------------


    application.ontime now + timevalue("00:00:30"), "Call_again"


    end sub


    'this is the repeating procedure


    sub call_again()


    operation1


    end sub


    ' The code for the Stop button which will execute the stop command and will pause the program execution of operation 1


    sub commandbutton2_click()
    stop
    end sub


    now at this point I want to call operation2 through my third button


    sub CommanButton3_click ()
    operation2
    end sub



    sub operation2()
    some set of statements
    -------------------
    -------------------
    -------------------
    msgbox "operation2 finishes"
    end sub


    after this I want Resume the Operation 1 from the point I have stopped by pressing the button 4 resume .


    sub commandbutton4_click()


    logic for resuming the operation1


    end sub


    I think I have explained most of the things
    now please provide some solution .


    Sachin

    Hi Dave,


    Can you please help me out in this one also ...


    I want to do the following :


    I have 4 buttons in my worksheet


    button 1 (Operation 1) :


    by clicking on this I am doing certain set of operations (operation1) repeatedly.
    let say its a public sub procedure which I will be looping
    This a procedure which is looped through application.ontime.


    button 2 (Suspend) :


    for suspending the operation1
    current I am using stop command for this functionality. I do not want to use wait as I want to do some other set of operations and do not want to use end as I want to resume from the point where I have stopped.


    button 3 (operation 2)


    And after this i will be able to click a 3rd button (Operation2) to do some other set of operations ( operation 2 )
    operation 2 is a small set of statements executed only once and no looping.



    button 4 (Resume Operation 1)


    after my operation 2 finishes I should be able to click on this button and resume my operation 1 from the point where I have stopped it


    Please reply.

    Hi Dave,


    Thanks,


    But can I access the cells of Sheet1 from the Macro.


    in the proc I need to populate certain values in the cell and change their properties like color etc. thats why I have put the proc in the Sheet1 but through module can I access the Cells in Sheet 1 or I need to access it by putting it as Sheet1.range("a1").value only.

    Hi ,


    I want to do the following :


    I have 4 buttons in my worksheet


    button 1 (Operation 1) :


    by clicking on this I am doing certain set of operations (operation1) repeatedly.
    let say its a public sub procedure which I will be looping
    This a procedure which is looped through application.ontime.


    button 2 (Suspend) :


    for suspending the operation1
    current I am using stop command for this functionality. I do not want to use wait as I want to do some other set of operations and do not want to use end as I want to resume from the point where I have stopped.


    button 3 (operation 2)

    And after this i will be able to click a 3rd button (Operation2) to do some other set of operations ( operation 2 )
    operation 2 is a small set of statements executed only once and no looping.



    button 4 (Resume Operation 1)


    after my operation 2 finishes I should be able to click on this button and resume my operation 1 from the point where I have stopped it



    Please help

    Hi dave ,


    I am not getting it
    Can you explain it a bit more clearly
    through steps .


    Actually the error is coming while calling the Sheet 1 proc from the Standard Module and not the other way around, as you have specified that I should call tha macro from the standard proc .


    And I also want to know why I am getting that error and that too sometime only.

    Hi Dave,


    Here is what I am trying to do :


    I have a command button in my sheet1


    Clicking on that command button I am calling a Proc in Sheet1 "my_proc"


    now after a certain time gap say 15 minutes I want to call this proc again
    for which I am using


    Application.ontime Now + timevalue("00:15:00") , "delay"


    but this delay proc I have to write as a module as I am not being allowed to call the delay in the same sheet and when I am writing this in a standard module as


    public sub delay()


    worksheets("sheet1").my_proc


    end sub


    then I am getting the following error sometimes but not always.


    run time error '91'
    object variable or with block variable not set.


    Previously with some other set of proc (also in the different sheet ) I am getting the same error then I shifted that proc to the same sheet and this error got resolved i.e. if I am calling some proc in some other sheet I am getting this error sometimes.

    Want to put a default value to range of cells that is not predefined :


    Suppose in Sheet1 if in Column A I have data upto row 13
    then I want to put 0(default value) in the range A1:E13 everytime sheet is opened.


    I must calculate the range first and then put the default value.

    when I am placing it in a standard module , sometimes I am getting the error Object / with object error.


    Actually I am calling from this proc I am calling a proc which is in Sheet 1.


    So, I want to put this proc also in the sheet 1 not in the standard module ....

    I want to call a procedure at some time say 3 o'clock and there after every 15 min.
    for this I am using Application.ontime method
    but I want to run a Proc in the current sheet (say sheet1) and not a standard module (macro)
    how can I do that ..........
    Can somebody help me out ..........