View Single Post
  #5  
Old 06-30-2009, 11:35 PM
bdb1974 bdb1974 is offline
Valued Forum Contributor
 
Join Date: 10 Dec 2008
Location: Austin
Posts: 414
bdb1974 is becoming part of the community
Re: Changing Date Values to a working Integer

Rob,

Thanks!!!
With your suggestions, I was able to piece together what I needed!
Your code alone had holes. So, here's what I assembled and it appears to work exactly how I need it too. With more testing, I'll surely find out.
Now, I feel like things are on the right track.

Code:
Sub Test()
    Dim OutIY As Worksheet
    Dim AnotherSht As Worksheet
    Dim findit As Range
    Dim i As Long

    'change as needed
    For i = 10 To Cells(Rows.Count, 1).End(xlUp).Row
    Set OutIY = Worksheets("Sheet1")
    Set WhichSht = Worksheets("Sheet1") ' ("Which Sheet should this be")
    Set findit = OutIY.Range("A:A").Find(what:=Cells(i, 1).Value)
     
    ''was originally...
    'If OutIY.Cells(i, "D") <> OutIY.Cells(i, "F") And WorksheetFunction.Int(Cells(i, "G").Value = WorksheetFunction.Int(today).Value) Then Cells(findit.Row, "G") = (Format(Now, "mm/dd/yyyy"))
    'try...
    If ((Cells(i, "D") <> Cells(i, "F")) And (WhichSht.Cells(i, "G").Value2 < CLng(Date))) Then
        With WhichSht.Cells(findit.Row, "G")
        Cells(findit.Row, "G") = Date
        Cells(i, "F") = Cells(i, "D")
          .Value2 = CLng(Date)
            .NumberFormat = "mm/dd/yyyy"
        End With
    Else
    'do nothing
    End If
        'release variables
        Set OutIY = Nothing
        Set AnotherSht = Nothing
        Set findit = Nothing
        Next i
        MsgBox "done"
    End Sub
Thanks again to all.

BDB
Reply With Quote