![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com