diamantebonita
New Member
- Joined
- May 25, 2011
- Messages
- 22
Arrrrgh!! how come dates are so hard to work with? I really thought this was gonna be a quick and easy program to write.
I want to check the date of the items in the list and determine if the date is today and/or within 7 days from today. This is how I determine the list that will be displayed. But i'm not able to get any of the DATE functions or statements to work.
Private Sub Workbook_Open()
Dim msg As String
Dim vendorL As String
Dim amountL As String
Dim duedateL As String
Sheets("Bills").Activate
Range("G2").Activate
If ActiveCell.Value = WorksheetFunction.Date() And ActiveCell.Value < WorksheetFunction.Date() + 7 Then
vendorL = ActiveCell.Offset(0, 2)
amountL = ActiveCell.Offset(0, 1)
duedateL = ActiveCell.Value
End If
Dim TodayDate As String
TodayDate = Format(Date, "Long Date")
msg = "Hello Genese!" & vbCrLf & vbCrLf
msg = msg & "Today is " & TodayDate & "." & vbCrLf
msg = msg & "These are the bills that need to be paid this week." & vbCrLf & vbCrLf
msg = msg & vendorL & vbTab & amountL & vbTab & duedateL & vbCrLf
MsgBox msg, vbInformation + vbOKOnly, "Bills To Pay"
End Sub
I want to check the date of the items in the list and determine if the date is today and/or within 7 days from today. This is how I determine the list that will be displayed. But i'm not able to get any of the DATE functions or statements to work.
Private Sub Workbook_Open()
Dim msg As String
Dim vendorL As String
Dim amountL As String
Dim duedateL As String
Sheets("Bills").Activate
Range("G2").Activate
If ActiveCell.Value = WorksheetFunction.Date() And ActiveCell.Value < WorksheetFunction.Date() + 7 Then
vendorL = ActiveCell.Offset(0, 2)
amountL = ActiveCell.Offset(0, 1)
duedateL = ActiveCell.Value
End If
Dim TodayDate As String
TodayDate = Format(Date, "Long Date")
msg = "Hello Genese!" & vbCrLf & vbCrLf
msg = msg & "Today is " & TodayDate & "." & vbCrLf
msg = msg & "These are the bills that need to be paid this week." & vbCrLf & vbCrLf
msg = msg & vendorL & vbTab & amountL & vbTab & duedateL & vbCrLf
MsgBox msg, vbInformation + vbOKOnly, "Bills To Pay"
End Sub
Last edited by a moderator: