I'm having trouble correcting this code I've written to output certain values on one of my data sheets to another sheet. I keep receiving the Run-time error '1004': Application-defined or object-defined error.
Any suggestions on how I can go about fixing this?
Sub ThirtyMinuteWarning()
Dim Row As Long
Dim EndRow As Long
Dim NextRow As Long
Dim NumWarnings As Integer
Row = 4
EndRow = Cells(Rows.Count, 3).End(xlUp).Row
NextRow = 10
Do Until Row = EndRow
If Cells(Row, 5).Value <> "" Then
For DoorCount = 4 To EndRow
If Cells(Row, 5).Value = Cells(DoorCount, 5).Value And Row <> DoorCount Then
For TimeCount = 4 To EndRow
If Cells(Row, 4).Value - 1 > Cells(TimeCount, 4).Value And Cells(Row, 4).Value - 6 <= Cells(TimeCount, 4).Value Then
Sheets("30 Minute Warnings").Cells(NextRow, 5).Value = Sheets("Calculations").Cells(Row, 6).Value
Sheets("30 Minute Warnings").Cells(NextRow, 6).Value = Sheets("Calculations").Cells(Row, 1).Value
Sheets("30 Minute Warnings").Cells(NextRow, 7).Value = Sheets("Calculations").Cells(Row, 5).Value
Sheets("30 Minute Warnings").Cells(NextRow, 8).Value = Sheets("Calculations").Cells(Row, 3).Value
End If
NextRow = NextRow + 1
Next TimeCount
End If
Next DoorCount
End If
Row = Row + 1
Loop
NumWarnings = Sheets("30 Minute Warnings").Cells(Rows.Count, 5).End(xlUp).Row - 5
Sheets("30 Minute Warnings").Cells(6, 5).Value = NumWarnings
End Sub
Bookmarks