LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
lee lee is offline
external usenet poster
 
Posts: 184
Default Delete row by color of font

That worked perfectly. I'd really like to understand the code. Would you
mind explaining why it works? Is UserResponse a special type of object?
Regards,
Lee

"Rick Rothstein" wrote:

Same code, different color property...

Sub DeleteRedFontRows()
Dim UserResponse As Variant
On Error GoTo NoRedFonts
Application.ScreenUpdating = False
Application.FindFormat.Font.Color = vbRed
Do
Columns("A").Find("*", SearchFormat:=True).EntireRow.Delete
Loop
NoRedFonts:
Application.ScreenUpdating = True
End Sub

Note the I used the VB built in constant vbRed instead of using an RGB
function call to produce the same value.

--
Rick (MVP - Excel)


"Lee" wrote in message
...
Hmmm, that didn't work for me. Perhaps the problem is that I have a
different color of Red than ColorIndex 3. This works:

Sub DeleteRowsWithRedFont()
Dim row As Integer
For i = 2 To 81
If Range(Cells(i, 1), Cells(i, 1)).Font.Color = RGB(255, 0, 0) Then
Rows(i).Delete shift:=xlUp
End If
Next
End Sub

However, I like your method better since there is less looping. Do you
know
how to relate RGB to ColorIndex colors?
Regards,
Lee



"Lee" wrote:

I have 80 rows of data and and one of the columns contains the serial
number
of the row (i.e. 1 through 80). The serial number font is normally black
but
if the font is red, I need to find the row number to delete that row.
Does
anyone know how to do that? It would be nice to do it without looping to
save time.
Thanks in advance,



 
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
Conditional Format for font color using font color Jim Excel Worksheet Functions 2 August 29th 09 11:54 AM
Delete text when font is color black CAM Excel Programming 2 June 28th 08 07:36 AM
Changing Font color based on font type or size John Excel Discussion (Misc queries) 2 February 7th 08 12:50 AM
Check Font or Font color and take action MSPLearner Excel Programming 3 November 15th 06 11:31 AM
My fill color and font color do not work in Excel Std Edition 2003 chapstick Excel Discussion (Misc queries) 1 September 11th 05 08:48 PM


All times are GMT +1. The time now is 08:37 PM.

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

About Us

"It's about Microsoft Excel"