Copy Data between Worksheets
Hi All,
I'm new to Macro Code. I need a help. I've 2 work sheets(Sheet4 and Sheet5). I've some data in Sheet4 which i've colored with 2 different colors(Say Red and Green). Now i would like to move(copy and paste) only data which are in Red color to another sheet(Sheet5). Can somebody help me? Thanks in advance, JP |
Copy Data between Worksheets
Run this macro:
Function is_it_red(i As Long) As Boolean is_it_red = False For j = 1 To Columns.Count If Cells(i, j).Interior.ColorIndex = 3 Then is_it_red = True Exit Function End If Next End Function Sub colorcopier() Dim i As Long k = 1 Set r = ActiveSheet.UsedRange nLastRow = r.Rows.Count + r.Row - 1 For i = 1 To nLastRow If is_it_red(i) Then Set rc = Cells(i, 1).EntireRow Set rd = Sheets("Copy If Red #2").Cells(k, 1) rc.Copy rd k = k + 1 End If Next End Sub Note, you need a sheet named "Copy If Red #2"; perhaps you should name your first sheet, the one with the reds on it, as such..."Copy If Red #1" Regards, Ryan--- -- RyGuy "Prabu" wrote: Hi All, I'm new to Macro Code. I need a help. I've 2 work sheets(Sheet4 and Sheet5). I've some data in Sheet4 which i've colored with 2 different colors(Say Red and Green). Now i would like to move(copy and paste) only data which are in Red color to another sheet(Sheet5). Can somebody help me? Thanks in advance, JP |
All times are GMT +1. The time now is 05:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com