Clear the content of cells

  • Thread starter Thread starter Yee
  • Start date Start date
Y

Yee

I am stuck at writng a macro that would:

search through the entire worksheet and clear the content
of the cell which contains a value of "N" (the N is
returned by formula). many thanks in advance
 
Hi
try the following

Sub clear_n()
Dim cell As Range
Dim rng As Range

Set rng = ActiveSheet.UsedRange
For Each cell In rng
If cell.Value = "N" Then 'change this to your requirements
cell.ClearContents
End If
Next
End Sub
 
Back
Top