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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top