+ Reply to Thread
Results 1 to 5 of 5

Can someone please help me fix this code I want the macro to start at 7am and run every 15

  1. #1
    Registered User
    Join Date
    05-28-2014
    Posts
    3

    Can someone please help me fix this code I want the macro to start at 7am and run every 15

    Hi All,

    I am new to VBA I have built a macro to capture data from one sheet to another.

    Can someone please help me fix this code I want the macro to start at 7am and run every 15 min after that till 6pm and then close the work book.

    Really appreciate any help thank you

    The code that I have is

    Sub Macro2()

    Dim BlankRow As Long

    Sheets("DATA").Select
    Range("E2:E5").Select
    Selection.Copy

    Sheets("EWFM").Select
    BlankRow = Range("E65536").End(xlUp).Row + 1
    Cells(BlankRow, 5).Select
    ActiveSheet.PasteSpecial xlPasteValuesAndNumberFormats

    Application.OnTime Now + TimeValue("00:15:00"), "Macro2"


    End Sub

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Can someone please help me fix this code I want the macro to start at 7am and run ever

    Try this.

    Please Login or Register  to view this content.
    Run Timed_Copy_Start to start the timer. If it's started before 7 AM, the first copy will be at 7 AM. If it's started after 7 AM. It will copy immediately and then every 15 minutes after.

    Run Timed_Copy_Quit if you ever want to stop the OnTime events manually. If you didn't do this and just closed the workbook but left Excel open, the workbook would reopen and run the OnTime event.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    05-28-2014
    Posts
    3

    Re: Can someone please help me fix this code I want the macro to start at 7am and run ever

    Thank you for that I will give it a go and let know how it goes, Really appericate your help.

  4. #4
    Registered User
    Join Date
    05-28-2014
    Posts
    3

    Re: Can someone please help me fix this code I want the macro to start at 7am and run ever

    It seems to be working but its coping the formula from the main cell, i need it to copy just the values ( just the numbers), i have also noticed that it sometime it copies the data 3-4 time in a 15 min run, is this issue because of the my excel.

    Quick question Do i need to leave Excel Open for this to run on time
    Thank you and really appreciate your help
    Last edited by nareenrv; 05-29-2014 at 09:03 PM.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Can someone please help me fix this code I want the macro to start at 7am and run ever

    Quote Originally Posted by nareenrv View Post
    It seems to be working but its coping the formula from the main cell, i need it to copy just the values ( just the numbers),
    Change this...
    Please Login or Register  to view this content.
    To this...
    Please Login or Register  to view this content.

    i have also noticed that it sometime it copies the data 3-4 time in a 15 min run, is this issue because of the my excel.
    I'm not sure why that would happen.

    Quick question Do i need to leave Excel Open for this to run on time
    Yes

    Thank you and really appreciate your help
    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Vb macro code to start from 100 ….
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-02-2013, 04:31 AM
  2. VBA code to start macro 'AfterSave' function
    By bchurchi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2013, 01:07 PM
  3. making a macro run automatically on start and make code work only on first sheet
    By Alheksi in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-12-2010, 04:18 AM
  4. [SOLVED] How to start a VB6 program form Excel VBA macro code ?
    By Øyvind in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2005, 12:55 PM
  5. Replies: 9
    Last Post: 05-29-2005, 02:05 AM

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