LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Copy Non-Colored Cells to a New Sheet

I tried the following macro to copy/paste non-colored cells to a sheet called
€˜Copy If Non Color. For some reason, all cells are copied to that sheet,
not just the non-colored cells. What am I doing wrong?

Sub noncolorcopier()
Dim w As Long
y = 1
Set z = ActiveSheet.UsedRange
nLastRow = z.Rows.Count + z.Row - 1
For w = 1 To nLastRow
If is_it_non_red(w) Then
Set rc = Cells(w, 1).EntireRow
Set rd = Sheets("Copy If Non Color").Cells(y, 1)
rc.Copy rd
y = y + 1
End If
Next


End Sub


Function is_it_non_red(w As Long) As Boolean
is_it_non_red = False
For x = 1 To Columns.Count
If Cells(w, x).Interior.ColorIndex = xlNone Or Cells(w,
x).Interior.ColorIndex = xlWhite Then
is_it_non_red = True
Exit Function
End If
Next
End Function


Regards,
Ryan---


--
RyGuy
 
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
Copy Sheet to new Sheet and clear cells on original sheets Boiler-Todd Excel Discussion (Misc queries) 7 September 23rd 09 10:02 PM
Copy sheet cells into differnt workbook/sheet, How? IVLUTA Excel Discussion (Misc queries) 2 June 2nd 09 11:16 PM
copy data of two cells from Sheet 2 into one cell in Sheet 1 cahabbinga Excel Worksheet Functions 6 January 30th 08 01:00 PM
How to copy a sheet and rename it with the value of two cells from the source sheet? Simon Lloyd[_717_] Excel Programming 0 May 12th 06 01:31 AM
Cell right next to colored cells is automatically colored on entering a value Johan De Schutter Excel Programming 6 September 12th 03 05:31 PM


All times are GMT +1. The time now is 03:07 AM.

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"