Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Macro that delets all cells containg ALL words in bold

I have a macro which delets content from cells if there is bold text in cell
..

Sub Delete_Bold_Text()
Dim i
For Each cell In ActiveSheet.UsedRange
cell.Select
For i = 1 To Len(ActiveCell)
If ActiveCell.Characters(Start:=i, _
Length:=1).Font.Bold = True Then
ActiveCell.ClearContents
End If
Next
Next
End Sub


The problem is that i have cells in which there is "normal" text and bolded
text and i don't want them deleted . I want to be deleted only cells in
which all text is bolded . Can this be done ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Macro that delets all cells containg ALL words in bold

Option Explicit
Sub Delete_Bold_Text2()
Dim myCell As Range
For Each myCell In ActiveSheet.UsedRange.Cells
If myCell.Font.Bold = True Then
myCell.ClearContents
End If
Next myCell
End Sub

andrei wrote:

I have a macro which delets content from cells if there is bold text in cell
.

Sub Delete_Bold_Text()
Dim i
For Each cell In ActiveSheet.UsedRange
cell.Select
For i = 1 To Len(ActiveCell)
If ActiveCell.Characters(Start:=i, _
Length:=1).Font.Bold = True Then
ActiveCell.ClearContents
End If
Next
Next
End Sub

The problem is that i have cells in which there is "normal" text and bolded
text and i don't want them deleted . I want to be deleted only cells in
which all text is bolded . Can this be done ?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro that delets all cells containg ALL words in bold

Hi,

If you test a cell for bold and only some of the text is bold Excel throws
an error so this can be utilised in the code to simply move on and ignore
that cell.

Sub Delete_Bold_Text()
On Error Resume Next
For Each Cell In ActiveSheet.UsedRange
If Cell.Font.Bold Then
Cell.ClearContents
End If
Next
End Sub

Mike

"andrei" wrote:

I have a macro which delets content from cells if there is bold text in cell
.

Sub Delete_Bold_Text()
Dim i
For Each cell In ActiveSheet.UsedRange
cell.Select
For i = 1 To Len(ActiveCell)
If ActiveCell.Characters(Start:=i, _
Length:=1).Font.Bold = True Then
ActiveCell.ClearContents
End If
Next
Next
End Sub


The problem is that i have cells in which there is "normal" text and bolded
text and i don't want them deleted . I want to be deleted only cells in
which all text is bolded . Can this be done ?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Macro that delets all cells containg ALL words in bold

Thanks guys !


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
Macro which searches for a character . When found delets what's be andrei Excel Programming 4 September 28th 09 06:09 PM
Make 1st word in cell bold after combining words from two cells [email protected] Excel Programming 10 June 5th 08 06:31 PM
How do I bold certain words or letters in a Msgbox in Excel macro TheGrimbler Excel Programming 2 October 9th 06 06:52 AM
select all cells in an active sheet containg links to other (external) workbooks. al007 Excel Programming 6 February 18th 06 02:54 PM
conditional formating using cells containg dates Roy Excel Discussion (Misc queries) 2 May 24th 05 09:52 PM


All times are GMT +1. The time now is 03:18 AM.

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"