EdwardSurrey
New Member
- Joined
- May 13, 2015
- Messages
- 36
- Office Version
- 365
- Platform
- Windows
Hello. I am using the following code to search for any cells that contain " " within a set range, and then clear the contents of those cells. I get a Type Mismatch (Run-time Error 13) and the debug highlights that the
If cell.Value = " " Then part. It does seem to work on cells it look at until it errors. I've been struggling to solve all morning - am I missing something obvious?![Smile :) :)](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f642.png)
Sub ClearDataV2()
Application.ScreenUpdating = False
For Each cell In Range("ImportData2")
If cell.Value = " " Then
cell.ClearContents
End If
Application.ScreenUpdating = True
Next
End Sub
If cell.Value = " " Then part. It does seem to work on cells it look at until it errors. I've been struggling to solve all morning - am I missing something obvious?
![Smile :) :)](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f642.png)
Sub ClearDataV2()
Application.ScreenUpdating = False
For Each cell In Range("ImportData2")
If cell.Value = " " Then
cell.ClearContents
End If
Application.ScreenUpdating = True
Next
End Sub