PC Review


Reply
Thread Tools Rate Thread

Delete text when font is color black

 
 
CAM
Guest
Posts: n/a
 
      28th Jun 2008
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

 
Reply With Quote
 
 
 
 
RyanH
Guest
Posts: n/a
 
      28th Jun 2008
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
>

 
Reply With Quote
 
CAM
Guest
Posts: n/a
 
      28th Jun 2008
Thanks Ryan,

Works like a charm. I appreciate your help.

Cheers

"RyanH" <(E-Mail Removed)> wrote in message
news:8889D21D-3400-475E-A33E-(E-Mail Removed)...
> 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
>>


 
Reply With Quote
 
New Member
Join Date: Feb 2011
Posts: 1
 
      25th Feb 2011
What is the formula for this?

Thanks chris

Quote:
Originally Posted by RyanH View Post
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
>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Rows as per Text, Font Color, Font Type, Time Format prkhan56 Microsoft Excel Programming 11 26th Oct 2010 01:35 PM
Excel 2003 Font Color reverts to black in color when moving to a Mike Microsoft Excel Crashes 4 28th Dec 2008 08:15 PM
TOC font color always black mike Microsoft Word Document Management 3 19th Nov 2008 02:33 AM
How do I make my black text single color black not 4 color black? =?Utf-8?B?TGFyYSBHbw==?= Microsoft Word Document Management 2 25th Aug 2006 07:01 PM
Font color defaults to yellow. Won't keep black font setting. =?Utf-8?B?d3N0cmljaw==?= Microsoft Outlook Discussion 0 25th Feb 2004 11:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:09 PM.