Results 1 to 7 of 7

Thread: vba code for excel file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2015
    Posts
    24

    Exclamation vba code for excel file

    I'm creating a worksheet name 'current' in which the data is extracted from the server. When server adds new information, new row of these information needs to be appeared in the 'current' worksheet at the last row and shows 'new' in first column. User can update new information from the 'current' worksheet by column and 'new' needs to be shown in first column as well. The 'new' needs to be amended everyday. At the same time, I would like to create another worksheet which named as 'past'. In 'past' worksheet, all the data in 'past' worksheet will be automatically transferred to 'yesterday' worksheet about 7pm each day which is being updated everyday as well. Please help.

    Thanks a lot.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vba code for excel file

    there is a recent thread that does several of these things see if it helps at all
    http://www.vbforums.com/showthread.p...s-over-a-range
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 2015
    Posts
    24

    Exclamation Re: vba code for excel file

    Hi westconn1, I've had a look at the thread you suggested and amended my code according to it. However, it doesn't seem to update the information for the time I set it to be. Would you mind helping me to check my code? Hope to hear from you soon.

    Code:
    Sub copypaste_RECENT()
    
    Sheets("t").Range("B:V").Copy Destination:=Sheets("y").Range("B:V")
    
    Application.OnTime Now + TimeSerial(12, 45, 0), "copypaste_RECENT"
    
    End Sub

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vba code for excel file

    is this procedure in a std module or an object module
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 2015
    Posts
    24

    Exclamation Re: vba code for excel file

    Hi westconn1, the procedure is in standard module.

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: vba code for excel file

    is every 12¾ hours the correct schedule? or should it be something different?

    if it is 12:45 pm, then it should not be adding the time to now
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Dec 2015
    Posts
    24

    Exclamation Re: vba code for excel file

    Hi westconn1, it's 12.45pm. Do you meant I should use Date instead of Now?

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width