Delete text when font is color black

  • Thread starter Thread starter CAM
  • Start date Start date
C

CAM

Hi,

I have a workbook that I has 10 sheets, which has different color fonts.
What I want to do is to delete all the cell content when there is a cell
with a black font for the entire workbook. I am using Excel 2007. I just
don't know how to go about the coding. Thank you in advance.

Cheers
 
This will clear each cell that has black font in each worksheet.

Sub DeleteContent()

Dim sh As Worksheet
Dim cell As Range

For Each sh In Worksheets
For Each cell In sh.UsedRange
If cell.Font.Color = vbBlack Then
cell.ClearContents
End If
Next cell
Next sh

End Sub

Hope ths helps! If so, then click "yes" below.
 
What is the formula for this?

Thanks chris

This will clear each cell that has black font in each worksheet.

Sub DeleteContent()

Dim sh As Worksheet
Dim cell As Range

For Each sh In Worksheets
For Each cell In sh.UsedRange
If cell.Font.Color = vbBlack Then
cell.ClearContents
End If
Next cell
Next sh

End Sub

Hope ths helps! If so, then click "yes" below.
--
Cheers,
Ryan


"CAM" wrote:

> Hi,
>
> I have a workbook that I has 10 sheets, which has different color fonts.
> What I want to do is to delete all the cell content when there is a cell
> with a black font for the entire workbook. I am using Excel 2007. I just
> don't know how to go about the coding. Thank you in advance.
>
> Cheers
>
 
Back
Top