Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default 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
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
Find and copy data from 2 worksheets Kclyn Excel Discussion (Misc queries) 7 September 30th 09 07:57 PM
Copy Data between worksheets Richard Boone Excel Discussion (Misc queries) 1 August 14th 09 12:08 AM
How to copy data from several worksheets into one Azra Akhter Excel Programming 3 September 28th 05 07:21 PM
copy/paste data between worksheets Anthony Excel Discussion (Misc queries) 0 February 5th 05 12:31 AM
copy data from 4 worksheets to master? john_t_h[_18_] Excel Programming 2 July 9th 04 09:19 AM


All times are GMT +1. The time now is 05:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"