Delete text when font is color black

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
 
R

RyanH

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.
 
Joined
Feb 25, 2011
Messages
1
Reaction score
0
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
>
 

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

Top