Results 1 to 4 of 4

Change data based on date field

Threaded View

  1. #1
    Registered User
    Join Date
    08-19-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    16

    Question Change data based on date field

    I have a file, a portion is attached, where I want to paste the value of the formula (in this case, just that of the external data) once it has grabbed the data from an external source.

    If the first time I open the file is Jan 15, I want it to grab the data in columns C, E and G from Jan 1 to Jan 14 and paste each cell's value in the same cell. Any data on Jan 15 or past Jan 15, I don't want the value (hasn't been collected yet).

    If I open the file again on Jan 18, I need the data from Jan 15 to Jan 17.

    I have this macro which works well for grabbing the data and pasting the value, but I am struggling doing this based on the date.

    Dim WS As Worksheet
    Dim Rng1 As Range
    Dim Cell As Range
    Dim lrow As Long
    
    lrow = Cells(Rows.Count, 1).End(xlDown).Row
    
    On Error Resume Next
    
    For Each WS In ActiveWorkbook.Worksheets
        With WS
            On Error Resume Next
            Set Rng1 = Cells.SpecialCells(xlCellTypeFormulas)
            On Error GoTo 0
                If Not Rng1 Is Nothing Then
                    For Each Cell In Rng1
                    If Left(Cell.Formula, 3) = "=AT" Then 'replaces only the externally retrieved data with the value
                        Cell.Value = Cell.Value
                    End If
                    Next
                End If
        Set Rng1 = Nothing
    End With
    
    Next
    Any suggestions on limiting this by date in the first column?
    Last edited by mtbe; 08-27-2009 at 09:51 AM. Reason: Solved

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