Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Delete cell with red text

A customer of mine is working with an Excel spreadsheet and has created a
macro that worked in Excel 2000 but is not working in Excel 2003. He has
cells that are marked with red text. When he runs this macro he would like
the red cells to delete. Do you know why this code is not working? Also,
how do I add code to this macro to show the active cell rather than having
the curser at the top of the document?

' LateList Macro
'

Set LoopRange = ActiveSheet.Range("E3:E250")
For Each Cel In LoopRange
' MsgBox (Cel.Font.ColorIndex & ", " & Cel.Interior.ColorIndex)
If Cel.Font.ColorIndex < 3 And Cel.Interior.ColorIndex = xlNone Then
Cel.EntireRow.Delete
End If
Next Cel

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Delete cell with red text

LateList Macro
'

Set LoopRange = ActiveSheet.Range("E3:E250")
For Each Cel In LoopRange
' MsgBox (Cel.Font.ColorIndex & ", " & Cel.Interior.ColorIndex)
If Cel.Font.ColorIndex < 3 And Cel.Interior.ColorIndex = xlNone
Then
Cel.EntireRow.Delete
End If
Next Cel

End Sub

the criteria in the code is that the colorindex of the Font is NOT red and
the interior of the cell is no fill. This would be the opposite of what you
describe as far as text color. Also, by looping forward and deleting, you
would miss adjacent rows that have red text.

LateList Macro
'
Dim LoopRange as Range, rng as Range, Cel as Range
Set LoopRange = ActiveSheet.Range("E3:E250")
For Each Cel In LoopRange
' MsgBox (Cel.Font.ColorIndex & ", " & Cel.Interior.ColorIndex)
cel.Activate
If Cel.Font.ColorIndex = 3 And Cel.Interior.ColorIndex = xlNone Then
if rng is nothing then
set rng = cel
else
set rng = Union(rng,cel)
End if
End If
Next Cel
if not rng is nothing then
rng.EntireRow.delete
End if
End sub
--
Regards,
Tom Ogilvy


End Sub


"Kara" wrote in message
...
A customer of mine is working with an Excel spreadsheet and has created a
macro that worked in Excel 2000 but is not working in Excel 2003. He has
cells that are marked with red text. When he runs this macro he would

like
the red cells to delete. Do you know why this code is not working? Also,
how do I add code to this macro to show the active cell rather than having
the curser at the top of the document?

' LateList Macro
'

Set LoopRange = ActiveSheet.Range("E3:E250")
For Each Cel In LoopRange
' MsgBox (Cel.Font.ColorIndex & ", " & Cel.Interior.ColorIndex)
If Cel.Font.ColorIndex < 3 And Cel.Interior.ColorIndex = xlNone

Then
Cel.EntireRow.Delete
End If
Next Cel

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Delete cell with red text

Font colorindex is a value in the 56 colour palette or
xlColorindexAutomatic. Also you are testing non-red cells, is this correct?

--
HTH

Bob Phillips

"Kara" wrote in message
...
A customer of mine is working with an Excel spreadsheet and has created a
macro that worked in Excel 2000 but is not working in Excel 2003. He has
cells that are marked with red text. When he runs this macro he would

like
the red cells to delete. Do you know why this code is not working? Also,
how do I add code to this macro to show the active cell rather than having
the curser at the top of the document?

' LateList Macro
'

Set LoopRange = ActiveSheet.Range("E3:E250")
For Each Cel In LoopRange
' MsgBox (Cel.Font.ColorIndex & ", " & Cel.Interior.ColorIndex)
If Cel.Font.ColorIndex < 3 And Cel.Interior.ColorIndex = xlNone

Then
Cel.EntireRow.Delete
End If
Next Cel

End Sub



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
how to delete a row with a cell containing certain number or text ann Excel Discussion (Misc queries) 2 June 16th 08 03:08 PM
delete text in a cell using certian criteria Ken Excel Discussion (Misc queries) 4 April 12th 08 06:19 AM
delete part of text from a cell andresg1975 Excel Worksheet Functions 4 October 20th 06 05:04 PM
Delete Spaces and Join Text in Cell Diggsy Excel Worksheet Functions 3 October 5th 05 03:50 AM
Delete text from cell containing text and numbers? index[_4_] Excel Programming 9 November 30th 03 09:48 PM


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