Good day all,
I had this working fine, Then I fixed a problem where my reports page retunred a lot of 01/01/1900 date lines that were not needed.
I fixed the formulas so that those cells would just be blank. And now my button doesn't work. It goes to the debugger and gives me this error
"runtime error 13
type missmatch"
this is the code its running
the debugger highlights the line in red
'set variables
Set datasheet = Sheet1
Set reportsheet = Sheet3
'clear old data
reportsheet.Range("A5:L100000").ClearContents
' TIME STAMP SHEET
reportsheet.Range("a5") = "THIS WEEK"
'next task
For i = 3 To datasheet.Cells(Rows.Count, 1).End(xlUp).Row
If datasheet.Cells(i, 1).Interior.ColorIndex <> 44 And _
datasheet.Cells(i, 1).Interior.ColorIndex <> 23 Then
If Year(datasheet.Cells(i, 8).Value) = Year(Date) And _
WorksheetFunction.WeekNum(datasheet.Cells(i, 8).Value, 2) = WorksheetFunction.WeekNum(Date, 2) Then
datasheet.Cells(i, 8).EntireRow.Copy
reportsheet.Range("a1000").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValuesAndNumberFormats
Application.CutCopyMode = False
End If
End If
Next i
reportsheet.Select
End Sub
I had this working fine, Then I fixed a problem where my reports page retunred a lot of 01/01/1900 date lines that were not needed.
I fixed the formulas so that those cells would just be blank. And now my button doesn't work. It goes to the debugger and gives me this error
"runtime error 13
type missmatch"
this is the code its running
the debugger highlights the line in red
'set variables
Set datasheet = Sheet1
Set reportsheet = Sheet3
'clear old data
reportsheet.Range("A5:L100000").ClearContents
' TIME STAMP SHEET
reportsheet.Range("a5") = "THIS WEEK"
'next task
For i = 3 To datasheet.Cells(Rows.Count, 1).End(xlUp).Row
If datasheet.Cells(i, 1).Interior.ColorIndex <> 44 And _
datasheet.Cells(i, 1).Interior.ColorIndex <> 23 Then
If Year(datasheet.Cells(i, 8).Value) = Year(Date) And _
WorksheetFunction.WeekNum(datasheet.Cells(i, 8).Value, 2) = WorksheetFunction.WeekNum(Date, 2) Then
datasheet.Cells(i, 8).EntireRow.Copy
reportsheet.Range("a1000").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValuesAndNumberFormats
Application.CutCopyMode = False
End If
End If
Next i
reportsheet.Select
End Sub