Hi,
I'm trying to create a condition such that if the range is not equal to zero then a message box appears (which works ok). However, i also want another condition that if the range is equal to zero, then it deletes a specified range.
At the moment, my problem is that if one part of the range is not equal to zero, then a message box appears - but if the rest of the range is zero, it continues to delete the specified range. I need it to not delete the specified range if any of the range is non zero i.e. the else condition is never realised if any of the range is non zero. Here is my code as it stands:
Sub Check_checks()
For Each r In Range("U7,U11,u84,u85,u161,u162, e231, e232")
If r.Value <> 0 Then
MsgBox "Check again"
Else
Range("U7:U9").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWindow.SmallScroll Down:=54
Range("U84:U85").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWindow.SmallScroll Down:=69
Range("U161:U162").Select
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWindow.SmallScroll Down:=69
Range("C228:E232").Select
Range("E232").Activate
Selection.ClearContents
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
ActiveWindow.SmallScroll Down:=-120
End If
Next
End Sub
Bookmarks