type mismatch on last part :(

J

Jay Baxter

I haev this code that compares dates to todays date and moves certain rows to another sheet.. The copying part works fine.. The problem i have having is in the ending of the code. I get type mismatch 13 but I dont know why. i have dates in all the columns cept the rows where there is no data anymore. Any help would be greatly appreciated.

The debugger yellows and highlights this lin
"If DateValue(ws3.Cells(1, 2)) - DateValue(ws3.Cells(iCt2, 13)) > 90 Then ws3.Rows(iCt2).Delete

Thank
Jay Baxte

Here is my code

Sub ArchivedRoutine(

Dim iCt2 As Intege
Dim iRow3 As Intege
Dim iRow4 As Intege
Dim ws3 As Workshee
Dim ws4 As Workshee
Dim erow2 As Intege

Set ws3 = Sheets("Closed"
Set ws4 = Sheets("Archived"
iRow3 =
erow2 =
While ws4.Cells(erow2, 13) <> "": erow2 = erow2 + 1: Wen
iRow4 = erow

'copy from sheet2 to sheet
Do Until ws3.Cells(iRow3, 13) = "
If DateValue(ws3.Cells(1, 2)) - DateValue(ws3.Cells(iRow3, 13)) > 90 The
For iCt2 = 1 To 1
ws4.Cells(iRow4, iCt2) = ws3.Cells(iRow3, iCt2
Next iCt
iRow4 = iRow4 +
End I
iRow3 = iRow3 +
Loo

'delete from sheet
For iCt2 = iRow3 To 2 Step -
If DateValue(ws3.Cells(1, 2)) - DateValue(ws3.Cells(iCt2, 13)) > 90 Then ws3.Rows(iCt2).Delet
Next iCt

End Sub
 
T

Tom Ogilvy

datevalue("")

returns a type mismatch.

if isdate(ws3.Cells(1,2)) and isDate(ws3.Cells(ict2,13)) then
If DateValue(ws3.Cells(1, 2)) - DateValue(ws3.Cells(iCt2, 13)) _
90 Then ws3.Rows(iCt2).Delete"
End if

--
Regards,
Tom Ogilvy

Jay Baxter said:
I haev this code that compares dates to todays date and moves certain rows
to another sheet.. The copying part works fine.. The problem i have having
is in the ending of the code. I get type mismatch 13 but I dont know why.
i have dates in all the columns cept the rows where there is no data
anymore. Any help would be greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

help with date comparision 1
help with code/syntax 0
Copy code that partly works 0
Copy if code 1
Code condition 3
Copy code failing 2
Quick Debug Help 3
Add sheet 2

Top