dversloot1
Board Regular
- Joined
- Apr 3, 2013
- Messages
- 113
Hello,
I'm attempting to clear the contents from a range of cells on rows where a cell string may equal R, X, XX, Y, Z, ZX, #N/A.
The macro runs fine until it gets to a cell that contains #N/A. Any idea how to get this to work?
Sub Recalculate()
Dim r As Integer
r = ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For Row = 13 To r
If _
Range("M" & Row) = "R" Or _
Range("M" & Row) = "X" Or _
Range("M" & Row) = "XX" Or _
Range("M" & Row) = "Y" Or _
Range("M" & Row) = "Z" Or _
Range("M" & Row) = "ZX" OR _
Range("M" & Row) = "#N/A" _
Then Range("O" & Row & ":Y" & Row).ClearContents Else
Next Row
Application.ScreenUpdating = True
End Sub
I'm attempting to clear the contents from a range of cells on rows where a cell string may equal R, X, XX, Y, Z, ZX, #N/A.
The macro runs fine until it gets to a cell that contains #N/A. Any idea how to get this to work?
Sub Recalculate()
Dim r As Integer
r = ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For Row = 13 To r
If _
Range("M" & Row) = "R" Or _
Range("M" & Row) = "X" Or _
Range("M" & Row) = "XX" Or _
Range("M" & Row) = "Y" Or _
Range("M" & Row) = "Z" Or _
Range("M" & Row) = "ZX" OR _
Range("M" & Row) = "#N/A" _
Then Range("O" & Row & ":Y" & Row).ClearContents Else
Next Row
Application.ScreenUpdating = True
End Sub