Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find and copy data from 2 worksheets | Excel Discussion (Misc queries) | |||
Copy Data between worksheets | Excel Discussion (Misc queries) | |||
How to copy data from several worksheets into one | Excel Programming | |||
copy/paste data between worksheets | Excel Discussion (Misc queries) | |||
copy data from 4 worksheets to master? | Excel Programming |