Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CAM CAM is offline
external usenet poster
 
Posts: 65
Default Delete text when font is color black

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Delete text when font is color black

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
CAM CAM is offline
external usenet poster
 
Posts: 65
Default Delete text when font is color black

Thanks Ryan,

Works like a charm. I appreciate your help.

Cheers

"RyanH" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why font color change back to black when I select a different cell Cody Excel Worksheet Functions 1 March 2nd 10 07:35 AM
Excel color-formatted text previews & prints in black Chery Excel Discussion (Misc queries) 0 January 16th 08 10:28 PM
Color Font Turns Black When Copied and Pasted BMA Charts and Charting in Excel 2 November 27th 06 10:28 PM
getting font color to stay black! buckfoston Excel Discussion (Misc queries) 1 June 2nd 06 10:37 PM
When I select a colored font, text is still showing up black. Why? onemanhattanrebel Excel Discussion (Misc queries) 1 September 25th 05 02:23 PM


All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"