Thread: Dated Fields
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Dated Fields

Yes.

Option Explicit
Sub testme()
With Worksheets("sheet1")
If .Range("a1").Value < Date - 30 Then
If .Range("M1").Value = "" Then
.Range("M1").Value = .Range("L1").Value
.Range("l1").ClearContents
End If
End If
End With
End Sub


You could even go through a range of cells:

Option Explicit
Sub testme()

Dim myCell As Range
Dim myRng As Range


With Worksheets("sheet1")
Set myRng = .Range("a2", .Cells(.Rows.Count, "A").End(xlUp))

For Each myCell In myRng.Cells
With myCell
If IsDate(.Value) Then
If .Value < Date - 30 Then
If .Cells(.Row, "M").Value = "" Then
.Cells(.Row, "M").Value = .Cells(.Row, "L").Value
.Cells(.Row, "L").ClearContents
End If
End If
End If
End With
Next myCell
End With
End Sub

(I added one more check--isdate().)



"stck2mlon <" wrote:

Is it possible to have a row with a date in one cell and a dollar amount
in another, have the dollar amount move one cell to the right once a
certain time has passed?

Example:
Once 30 days has elapsed, have $10.00 move from column L to M

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson