0
votes

I'm getting a Run Time Error 13: Type Mismatch every time I run this code. It's supposed to clear three columns of cells, move over the next three columns and then clear another three until it runs out of columns with values. The Error is appearing on the Do While ActiveCell.Value <> "" line.

Sub Blanker()
    Sheets("Sheet1").Select
    Range("BCF3").Select
    Do While ActiveCell.Value <> ""
        Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(106, 2)).Select
        Selection.Clear
        ActiveCell.Offset(0, 6).Select        
    Loop
End Sub
2

2 Answers

0
votes

I am not sure why you are using a loop to do something what appears to be just one time. Try this:

Sub Blanker()

Sheets("Sheet1").Select
Range("BCF3").Select
If ActiveCell.Value <> vbNullString Then
    Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(106, 2)).Select
    Selection.Clear
    ActiveCell.Offset(0, 6).Select
End If

End Sub
0
votes

The code didn't work with non-numerical values. Specifically #VALUE!. I changed all instances of #VALUE! to 0 and the code worked.