+ Reply to Thread
Results 1 to 4 of 4

Copy macro (depending on date)

Hybrid View

  1. #1
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Post Copy macro (depending on date)

    Hi All,

    I need help with my tracker. Im new when it comes to using VBA.. Im guilty in just using record to get stuff done..

    Problem I have now is how can I copy the details in Sheet1 (B5:B8) to DB worksheet in the corresponding date..
    Also the now() function always adjust.

    Please help me on this...

    duration tracker.xlsm
    Last edited by city; 01-01-2012 at 01:08 PM.

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: Copy macro (depending on date)

    One possibility...
    Sub record()
        Dim vData As Variant
        Dim dDate As Date
        Dim x As Long
    'COLLECT DATA
        With Worksheets("Sheet1")
            vData = .Range("B5:B8").Value2
            dDate = .Range("A2").Value2
        End With
    'POST DATA
        With Worksheets("Db")
            For Each rng In .Range("B2:K2")
                If rng.Value2 = dDate Then rng.Offset(2, 0).Resize(4, 1) = vData
            Next
        End With
    End Sub
    Also. change =Now() to =Today() and preformat the Db time cells.
    Last edited by dangelor; 12-30-2011 at 06:26 PM.

  3. #3
    Registered User
    Join Date
    11-17-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    70

    Re: Copy macro (depending on date)

    Thanks dangelor. It really works. Thanks a lot!

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: Copy macro (depending on date)

    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)

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