Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default reformulation question

I have a spreadsheet that is about 3000x24. Extensive Search and replace has
changed cell color for cells whose content matches search criteria (red
cell). there
are now about 400 colored cells spread throughout the worksheet. I want to
select each row that has a colored cell and place it in a new worksheet. Any
suggestions how to automate this?
--
Phantom Researcher

--
Phantom Researcher
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default reformulation question

Sub RedRows()
Dim rng As Range, red As Range
Dim x As Long, y As Long
Dim n As Long, m As Long
With ActiveSheet
'start the union with the first empty row below.
Set red = .UsedRange.Resize(1).Offset(.UsedRange.Rows.Count)
Set rng = .UsedRange.Cells(1)
n = .UsedRange.Rows.Count - 1
m = .UsedRange.Columns.Count - 1
End With
With rng
For x = 0 To n
For y = 0 To m
If .Offset(x, y).Interior.ColorIndex = 3 Then
Set red = Union(red, .Offset(x, 0).Resize(1, m + 1))
Exit For
End If
Next
Next
End With
'clear the empty row from the union
Set red = Intersect(red, ActiveSheet.UsedRange)
'copy the union to sheet2
red.Copy activeworkbook.Worksheets(2).Cells(1)

End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


?B?RWR3YXJk?= wrote in message
:

I have a spreadsheet that is about 3000x24. Extensive Search and
replace has changed cell color for cells whose content matches search
criteria (red cell). there
are now about 400 colored cells spread throughout the worksheet. I
want to select each row that has a colored cell and place it in a new
worksheet. Any suggestions how to automate 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
Excel 2007 Macro/VB Question DDE Question MadDog22 Excel Worksheet Functions 1 March 10th 10 01:47 AM
where can I see my question and answer? Yesterday I ask a question IP Excel Discussion (Misc queries) 2 May 10th 08 04:08 PM
Newbie Question - Subtraction Formula Question [email protected] Excel Discussion (Misc queries) 3 May 5th 06 05:50 PM
The question is an excel question that I need to figure out howto do in excel. Terry Excel Worksheet Functions 3 January 23rd 06 06:22 PM
reformulation question Edward Excel Worksheet Functions 0 November 5th 04 10:43 PM


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