+ Reply to Thread
Results 1 to 10 of 10

Help with Application.OnTime (was Application.Wait Now)

  1. #1
    Registered User
    Join Date
    08-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    37

    Help with Application.OnTime (was Application.Wait Now)

    Hi all,

    I think I know the answer to this but I'm not 100% sure.

    I have a macro that performs a series of calculations along rows of cells every n seconds using the Application.Wait Now + TimeValue("00:00:n") function in a simple Do Loop While offsetting the active cells.

    During the pauses I'd like to update some cell values (a simple button to send a value will suffice), but am I right in thinking that during these pauses the Workbook is 'locked' from any input? Or is there a way around this?

    Thanks in advance

    W
    Last edited by Walter12; 08-28-2012 at 02:05 PM.

  2. #2
    Registered User
    Join Date
    08-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Updating cell values during Application.Wait Now ?

    OK, so I've managed to use this example from the forums of using Application.OnTime to perform tasks at regular intervals. And this seem to stop and start the macro so I can manipulate data in between calculations.

    However, does anyone know how I could perform calculations on offset cells on every OnTime event but starting from a defined cell? I can only get the example below to use ActiveCell, which is annoying as I'm activating other cells by manipulating their data which transposes the code below onto the wrong cells.

    For example, I need to start at A1 calculate, and then calculate B1, and then C1.
    This then transposes to the next row (starting A2, A3, A4) every n seconds.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Help with Application.OnTime (was Application.Wait Now)

    Is there anyone out there who's done this before?

  4. #4
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Help with Application.OnTime (was Application.Wait Now)

    At the top of the module put:
    Please Login or Register  to view this content.
    Within MacroAutoRun1 insert:
    Please Login or Register  to view this content.
    Change "Sheet1" to the appropriate sheet name and replace all occurrences of ActiveCell with theCell.
    Post responsibly. Search for excelforum.com

  5. #5
    Registered User
    Join Date
    08-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Help with Application.OnTime (was Application.Wait Now)

    Thank you very much Chippy. This seems to work except only the first calculation is occurring out of the two in my code. Is this anything to with defining the row as row A?

    Please Login or Register  to view this content.
    Last edited by Walter12; 08-28-2012 at 04:11 PM.

  6. #6
    Registered User
    Join Date
    08-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Help with Application.OnTime (was Application.Wait Now)

    Aha! OK, so using Set theCell = Sheets("Sheet1").Cells(row, "B") fixed this to set the next column for the next calculation.

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: Help with Application.OnTime (was Application.Wait Now)

    Simple debugging with Debug.Print theCell.Address found a gotcha with theCell.Offset(0, 1).Select. Here's a better way:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Help with Application.OnTime (was Application.Wait Now)

    Again, thanks.

    People on this forum are so helpful!

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Help with Application.OnTime (was Application.Wait Now)

    @ Walter12

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  10. #10
    Registered User
    Join Date
    08-24-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: Help with Application.OnTime (was Application.Wait Now)

    Quote Originally Posted by Cutter View Post
    @ Walter12

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Duly noted

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1