diamantebonita
New Member
- Joined
- May 25, 2011
- Messages
- 22
Could someone tell me whats wrong here? The code is supposed to go through a list of dates, and any that are either today or within the week, its supposed to copy the related cells and paste in a separate area of the spreadsheet.
Private Sub Workbook_Open()
Dim msg As String
Dim vendorL As String
Dim amountL As String
Dim duedateL As String
Dim FinalRow As Integer
Dim TodayDate As String
Dim Cell As Range
Sheets("Bills").Activate
Range("G2").Activate
FinalRow = Cells(Rows.Count, 7).End(xlUp).Row
For Each Cell In Range("G2:G" & FinalRow)
If Cell.Value >= Date And Cell.Value < Date + 7 Then
Range(ActiveCell.Offset(0, -2), ActiveCell).Copy
Range("AA1").Select
If Cell.Value = "" Then
Selection.PasteSpecial Paste:=xlPasteValues
Else
Do
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Value = ""
Selection.PasteSpecial Paste:=xlPasteValues
End If
Else
ActiveCell.Offset(1, 0).Select
End If
Next Cell
Any help would be appreciated. Thanks!
Private Sub Workbook_Open()
Dim msg As String
Dim vendorL As String
Dim amountL As String
Dim duedateL As String
Dim FinalRow As Integer
Dim TodayDate As String
Dim Cell As Range
Sheets("Bills").Activate
Range("G2").Activate
FinalRow = Cells(Rows.Count, 7).End(xlUp).Row
For Each Cell In Range("G2:G" & FinalRow)
If Cell.Value >= Date And Cell.Value < Date + 7 Then
Range(ActiveCell.Offset(0, -2), ActiveCell).Copy
Range("AA1").Select
If Cell.Value = "" Then
Selection.PasteSpecial Paste:=xlPasteValues
Else
Do
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Value = ""
Selection.PasteSpecial Paste:=xlPasteValues
End If
Else
ActiveCell.Offset(1, 0).Select
End If
Next Cell
Any help would be appreciated. Thanks!