Hi All:
I'm using a set of forms to capture data, save it to dated workbook, and copy data to access97 using DAO. In order to not have null data in the database, I'm trying to delete rows if the values in adjacent cells C3 and D3 (C4 and D4...C6, D6) is 0. After a search of the board I found, and modified, this code (thanks Nimrod):
Option Explicit
Public Sub DelRowsbyCellValue()
Dim rw As Integer
With Worksheets("Filters")
For rw = 1 To .Range("a1:a" & Cells(65536, 1).End(xlUp).Row)
If Cells(rw, 3).Value = 0 And Cells(rw, 4).Value = 0 Then
Cells(rw, 4).EntireRow.Delete
rw = rw - 1
End If
Next
End With
End Sub
When this code runs I get an "Error 13, Type Mismatch".
Any thoughts, hints, or suggestions??
Is there a better way to do this?
By the by, the workbook hides when the forms load so the user never sees it.
Thanks in advance
Dave
Here is the original post of the above code http://www.mrexcel.com/board/viewtopic.php?topic=10744&forum=2
I'm using a set of forms to capture data, save it to dated workbook, and copy data to access97 using DAO. In order to not have null data in the database, I'm trying to delete rows if the values in adjacent cells C3 and D3 (C4 and D4...C6, D6) is 0. After a search of the board I found, and modified, this code (thanks Nimrod):
Option Explicit
Public Sub DelRowsbyCellValue()
Dim rw As Integer
With Worksheets("Filters")
For rw = 1 To .Range("a1:a" & Cells(65536, 1).End(xlUp).Row)
If Cells(rw, 3).Value = 0 And Cells(rw, 4).Value = 0 Then
Cells(rw, 4).EntireRow.Delete
rw = rw - 1
End If
Next
End With
End Sub
When this code runs I get an "Error 13, Type Mismatch".
Any thoughts, hints, or suggestions??
Is there a better way to do this?
By the by, the workbook hides when the forms load so the user never sees it.
Thanks in advance
Dave
Here is the original post of the above code http://www.mrexcel.com/board/viewtopic.php?topic=10744&forum=2