how to perform certain code on specific time in android?

Final code ready to enter

  • QUESTION: Isaac, It would not allow me to do another follow up. I am about to enter the final code. Can you just review it one last time to make sure it all looks right. Private Sub Worksheet_Change(ByVal Target As Range) Application.ScreenUpdating = False If Not Application.Intersect(Target, Range("D2")) Is Nothing Then Select Case Target.Value Case 1997 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData1997 Case 1998 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData1998 Case 1999 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData1999 Case 2000 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2000 Case 2001 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2001 Case 2002 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2002 Case 2003 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2003 Case 2004 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2004 Case 2005 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2005 Case 2006 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2006 Case 2007 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2007 Case 2008 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2008 Case 2009 Application.Wait (Now + TimeValue("0:00:01")) ReplaceData2009 Case Else Exit Sub End Select End If Application.ScreenUpdating = True End Sub ANSWER: course I don't know the cell references, sheet names or sub names but it does look correct to me ... you probably want to test it out .... Let's say you are testing it in the "real" workbook. Yes, it's true that you won't be able to "Undo" the action that the code does. However, you always will have the option to Close the workbook without saving. (unless you had some code in the Workbook_Before Close event to automatically save it). ---------- FOLLOW-UP ---------- QUESTION: Isaac, The code worked well. I am still having problems with the time the macro starts to load. I have a pretty large data base pulling other data into the viewing sheets from two hidden files where the main data comes in from an outside source. I have two sheets of data that are being loaded through Vlookup from a1 cell at the top of those two pages. So the vlookup runs through and pulls all the data out of the main data file. Puts that data into the rest of the workbook. This process takes any where from 4-15 secs depending on amount of data and speed of computer at that moment in time. So I set the time stamp to 15 secs. Then the macro to cut and paste that data into the final sheet triggers. The problem is if for some reason the computer is bogged down or it takes longer than 15 sec for any strange reason. It will mess up the data. So a long story to get to the question of: is there a way to add one more criteria of " no other processes running when triggered". The way that I connected the two was to have the vlookup point to the same cell as the data validation dropdown. So when the data validation is triggered by the end user the two other cells trigger the vlookup to perform the data switch on sheettwo, and sheet three. Meanwhile Sheetthree is performing the cut and paste macro relying on the data to already be loaded into sheetthree from the vlook up. If this does not happen then the macros should not be triggered or should be triggered once complete. Hmm last sentence seems like the codeable phrase....How do I code this? Thanks again. I hope I did not confuse you.

  • Answer:

    Wow, I'm definitely confused. I guess I don't run into this much because usually when I useto run reports or queries, I do it by way of this type of approach (just a thought for you): -simple access database is where the true query is -this query may contain "linked" tables (often linked directly to theworksheet), thus handling things like paramaters or criteria, user can enter them right in excel -record macro to import data (run query from access database) -have additional code after "import data / run query" code this eliminates problem with timing. All the code "after" the query just automatically waits because the lines of code to perform the query come before the lines of code that come after it. So I just don't understand enough about why you have code running too soon. If you can tell me specifically what your code is, near the end, the last thing you referred to, let me see what I can come up with. Or why not just break your code up into "step 1" and "step2" , both independent from each other, and triggered by the user?

Miningco.com Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.