Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Removal red rows in excel

Lets say I have an excel spreadsheet file that consists of a number rows with
text, each of which is painted in either of two colors: green or red. I want
to remove those rows that colored in red. how can I do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Removal red rows in excel

Hi Jimmy,

Try:

'================
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim LastRow As Long
Dim rCell As Range
Dim delRng As Range

Set WB = ActiveWorkbook '<<===== CHANGE
Set SH = WB.Sheets("Sheet1") '<<===== CHANGE

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

Set rng = SH.Range("A1:A" & LastRow)

For Each rCell In rng.Cells
With rCell
If .Interior.ColorIndex = 3 Then
If delRng Is Nothing Then
Set delRng = rCell
Else
Set delRng = Union(rCell, delRng)
End If
End If
End With
Next rCell

If Not delRng Is Nothing Then
delRng.EntireRow.Delete
End If


End Sub
'<<================



---
Regards,
Norman


"Jimmy Ionic" wrote in message
...
Lets say I have an excel spreadsheet file that consists of a number rows
with
text, each of which is painted in either of two colors: green or red. I
want
to remove those rows that colored in red. how can I do this?



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
Auto Removal Of Duplicate Rows Astro Excel Worksheet Functions 1 February 19th 09 09:21 AM
Excel Error Msg following Removal of Oracle im1dge Setting up and Configuration of Excel 0 February 21st 06 08:30 PM
file removal before Excel closing Jean-Luc CAPEL Excel Programming 0 November 29th 05 12:46 PM
excel 4.0 macro removal tool Sachin Shah Excel Discussion (Misc queries) 0 August 25th 05 04:17 AM
Excel Password Removal A. Gentry Excel Discussion (Misc queries) 5 June 1st 05 12:22 AM


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