ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating a macro that pulls rows by the color (https://www.excelbanter.com/excel-programming/325075-creating-macro-pulls-rows-color.html)

Aria

Creating a macro that pulls rows by the color
 
I have a spreadsheet that has data and each row is color coded to reflect a
status. I would like to create a macro that groups each color category
together in a separate worksheet.

For instance: Blue = Under Development. I created a worksheet called "Under
Development" and instead of having to manually scroll through the entire
original worksheet and copy each Blue row, I want the macro to do it for me,
and insert these rows (according to color - in this case, BLUE) in the new
worksheet, "Under Development"

Can anyone help?

Thanks,

Toppers

Creating a macro that pulls rows by the color
 
This selects rows by testing column A for "blue" (colorindex=41) and copies
rows to new worksheet, starting in row 2.

Sub MoveRowsByColour()

Dim rngA As Range

With Worksheets("sheet1") ' Original source
Set rngA = Range(.Cells(1, 1), .Cells(Rows.Count, 1).End(xlUp))
End With

For Each cell In rngA
If cell.Interior.ColorIndex = 41 Then
cell.EntireRow.Copy _
Destination:=Sheets("Under
Development").Range("A65536").End(xlUp).Offset(1, 0)

End If
Next

End Sub

"Aria" wrote:

I have a spreadsheet that has data and each row is color coded to reflect a
status. I would like to create a macro that groups each color category
together in a separate worksheet.

For instance: Blue = Under Development. I created a worksheet called "Under
Development" and instead of having to manually scroll through the entire
original worksheet and copy each Blue row, I want the macro to do it for me,
and insert these rows (according to color - in this case, BLUE) in the new
worksheet, "Under Development"

Can anyone help?

Thanks,


Ron de Bruin

Creating a macro that pulls rows by the color
 
See Bob's site Aria
http://www.xldynamic.com/source/xld.ColourCounter.html


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



"Aria" wrote in message ...
I have a spreadsheet that has data and each row is color coded to reflect a
status. I would like to create a macro that groups each color category
together in a separate worksheet.

For instance: Blue = Under Development. I created a worksheet called "Under
Development" and instead of having to manually scroll through the entire
original worksheet and copy each Blue row, I want the macro to do it for me,
and insert these rows (according to color - in this case, BLUE) in the new
worksheet, "Under Development"

Can anyone help?

Thanks,





All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com