Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default VBA - Delete row if cell contents bold text

How can this be modified to delete a row if bold text is in a specific column?

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

Thanks!

Scott
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default VBA - Delete row if cell contents bold text

Dim CCell As Range

On Error Resume Next
For Each CCell In Intersect(ActiveSheet.Columns(2), ActiveSheet.UsedRange)
If CCell.Characters.Font.Bold Then CCell.EntireRow.Delete
Next CCell
On Error Goto 0

This only works if the entire cell is bolded; if you need to find if any
individual character is bold you would have to step through each Character in
CCell.Characters - that would also take significantly more time to run. So
hopefully this simple version is what you need.
--
- K Dales


"Scott Wagner" wrote:

How can this be modified to delete a row if bold text is in a specific column?

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

Thanks!

Scott

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA - Delete row if cell contents bold text

That didn't work for me. It had problems with successive cells being blank
(as expected).

Sub BBB()
Dim lastrow as Long, i as Long
lastrow = Cells(Rows.Count, 2).End(xlUp).Row
For i = lastrow To 1 Step -1
If Cells(i, 2).Font.Bold Then
Rows(i).Delete
End If
Next
End Sub

avoids that problem.

--
Regards,
Tom Ogilvy




"K Dales" wrote in message
...
Dim CCell As Range

On Error Resume Next
For Each CCell In Intersect(ActiveSheet.Columns(2), ActiveSheet.UsedRange)
If CCell.Characters.Font.Bold Then CCell.EntireRow.Delete
Next CCell
On Error Goto 0

This only works if the entire cell is bolded; if you need to find if any
individual character is bold you would have to step through each Character

in
CCell.Characters - that would also take significantly more time to run.

So
hopefully this simple version is what you need.
--
- K Dales


"Scott Wagner" wrote:

How can this be modified to delete a row if bold text is in a specific

column?

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

Thanks!

Scott



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA - Delete row if cell contents bold text

successive cells being blank

should have been

successive cells being BOLD

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
That didn't work for me. It had problems with successive cells being

blank
(as expected).

Sub BBB()
Dim lastrow as Long, i as Long
lastrow = Cells(Rows.Count, 2).End(xlUp).Row
For i = lastrow To 1 Step -1
If Cells(i, 2).Font.Bold Then
Rows(i).Delete
End If
Next
End Sub

avoids that problem.

--
Regards,
Tom Ogilvy




"K Dales" wrote in message
...
Dim CCell As Range

On Error Resume Next
For Each CCell In Intersect(ActiveSheet.Columns(2),

ActiveSheet.UsedRange)
If CCell.Characters.Font.Bold Then CCell.EntireRow.Delete
Next CCell
On Error Goto 0

This only works if the entire cell is bolded; if you need to find if any
individual character is bold you would have to step through each

Character
in
CCell.Characters - that would also take significantly more time to run.

So
hopefully this simple version is what you need.
--
- K Dales


"Scott Wagner" wrote:

How can this be modified to delete a row if bold text is in a specific

column?

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

Thanks!

Scott





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VBA - Delete row if cell contents bold text

Hi Scott

EasyFilter have this option
http://www.rondebruin.nl/easyfilter.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Scott Wagner" wrote in message ...
How can this be modified to delete a row if bold text is in a specific column?

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

Thanks!

Scott





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VBA - Delete row if cell contents bold text

Hi Scott

I fixed a bug in the delete option on the color tab of the add-in
I upload a new version


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Hi Scott

EasyFilter have this option
http://www.rondebruin.nl/easyfilter.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Scott Wagner" wrote in message ...
How can this be modified to delete a row if bold text is in a specific column?

On Error Resume Next
Columns(2).SpecialCells(xlCellTypeBlanks).EntireRo w.Delete
On Error GoTo 0

Thanks!

Scott





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
change cell contents to bold dave@penneys Excel Worksheet Functions 5 September 20th 07 08:25 PM
Bold and formated cell wnat to delete in one stroke Qazi Ahmad Excel Discussion (Misc queries) 3 January 11th 07 05:54 PM
Join bold and non-bold text in one cell bkincaid Excel Discussion (Misc queries) 3 March 21st 06 12:58 AM
Delete rows with bold or italic text MAYDAY[_6_] Excel Programming 3 October 20th 05 11:21 PM
Bold some of the cell contents Brad Excel Programming 4 April 25th 05 04:49 PM


All times are GMT +1. The time now is 12:35 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"