M
mark_the_yeti
Hello,
My goal is to prevent the workbook from closing if there is not a value in
Row 4, Column 4 when Row 4, Column 5 does have a value. This condition would
apply for rows 4 to 454.
I think I'm headed in the right direction, but I must be missing something...
So far I have:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
For i = 4 To 454
Set hours = Worksheets("Test").Cells(i, 5)
Set task = Worksheets("Test").Cells(i, 4)
If hours = 0 Then
Cancel = False
Else
If task = 0 Then
Cancel = True
End If
End If
Next i
End Sub
My goal is to prevent the workbook from closing if there is not a value in
Row 4, Column 4 when Row 4, Column 5 does have a value. This condition would
apply for rows 4 to 454.
I think I'm headed in the right direction, but I must be missing something...
So far I have:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
For i = 4 To 454
Set hours = Worksheets("Test").Cells(i, 5)
Set task = Worksheets("Test").Cells(i, 4)
If hours = 0 Then
Cancel = False
Else
If task = 0 Then
Cancel = True
End If
End If
Next i
End Sub