Results 1 to 5 of 5

Thread: macro to drag and fill formula til the time stamp match

  1. #1
    Junior Member
    Join Date
    Jan 2015
    Posts
    3
    Rep Power
    0

    macro to drag and fill formula til the time stamp match

    I have this WB, how to autofill formula to D:G range til the time stamp is same as cell J1
    Attached Files Attached Files
    Last edited by AS_2011; 01-08-2015 at 08:07 AM.

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    In I1,

    =MATCH(J1-INT(J1),C4:C47)

    In H1, type 1. To stop macro type 0 in H1

    Code:
    Sub StartMacro()
        
        Dim r, t As Date, i As Long
        
        t = Now() + TimeSerial(0, 0, 5)
        
        Application.OnTime t, "StartMacro", , True
        
        r = [i1]
        i = [h1]
        
        If Not i = 0 Then
            If Not IsError(r) Then
                Range("d4:h4").AutoFill Range("d4:h4").Resize(r)
            End If
        Else
            Debug.Print Now
            Application.OnTime t, "StartMacro", , False
        End If
        
    End Sub
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Junior Member
    Join Date
    Jan 2015
    Posts
    3
    Rep Power
    0
    I can't get it to work, I1 show #N/A when i run the macro, can use macro button to run and stop the macro?

  4. #4
    Junior Member
    Join Date
    Jan 2015
    Posts
    3
    Rep Power
    0
    Admin, I think i found the problem, in the time column i am using some formula to get the time, how to add the code to change the time formula to value in your code? when the value of time format is m/dd/yyyy h:mm:ss AM/PM I1 show #N/A, but when i change the time format to h:mm:ss AM/PM, it is good,
    Last edited by AS_2011; 01-09-2015 at 12:05 PM.

  5. #5
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    modify your formula like

    =YourOriginalFormula-INT(YourOriginalFormula)

    And format the cell as time
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Replies: 0
    Last Post: 10-23-2013, 04:58 AM
  2. Replies: 7
    Last Post: 07-26-2013, 06:34 PM
  3. Macro to match identical names and allocate ID's
    By foncesa in forum Excel Help
    Replies: 8
    Last Post: 06-23-2013, 12:50 PM
  4. Replies: 3
    Last Post: 03-12-2013, 12:54 PM
  5. Macro to clear data based on color fill
    By Howardc in forum Excel Help
    Replies: 7
    Last Post: 12-03-2012, 09:25 AM

Posting Permissions

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