How do I get this to work? I have this code written so far:
Sub RemoveLoop()
Dim i As Long
For i = 6 To 15
If Range("B" + i) = "YES" Then
Range("C" + i + ":" + "P" + i).ClearContents
End If
Next i
End Sub
Instead of doing each individually like this: This is what I'm trying to shorten/accomplish, below:
Sub Remove()
If Range("B6") = "YES" Then
Range("C6:P6").ClearContents
End If
If Range("B7") = "YES" Then
Range("C7:P7").ClearContents
End If
If Range("B8") = "YES" Then
Range("C8:P8").ClearContents
End If
If Range("B9") = "YES" Then
Range("C9:P9").ClearContents
End If
If Range("B10") = "YES" Then
Range("C10:P10").ClearContents
End If
If Range("B11") = "YES" Then
Range("C11:P11").ClearContents
End If
If Range("B12") = "YES" Then
Range("C12:P12").ClearContents
End If
If Range("B13") = "YES" Then
Range("C13:P13").ClearContents
End If
If Range("B14") = "YES" Then
Range("C14:P14").ClearContents
End If
If Range("B15") = "YES" Then
Range("C15:P15").ClearContents
End If
End Sub
Simple question for you guys, thank you for your help. I don't know what else to say, it's pretty straight forwards I believe. But I'm still getting the, "Looks like your most is mostly code error." This should be an easy one for you VBA experts to solve.
Thanks again.
+with&Worksheets("Sheet1").Range..... At least use theActiveSheet.Range...