Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2004, 09:08 AM
Authorized User
 
Join Date: Oct 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to SiliconFuRy
Default Row by Row

I have a spreadsheet with several columns(A thru H) and a couple of thousand rows, and certain rows have one or more cells with a background color of red.

What I'd like to do is to do a for each in every cell in every row, check its background color, if its red, then copy the ENTIRE row into another worksheet, not necessarily the same row number (ie, if it was row 799, and there are currently 3 rows in the new table, then copy row 799 from the old to row 4 in the new).

Another slight problem is that the cells both contain forumalas and static values (the formulas being vlookups).

I'm guessing I'd do..

For Each myCell in mySheet.Range("A:H").SpecialCells(xlCellTypeAllFor matConditions)

If any 1 cell in row has bgcolor = red Then
' copy this row from ActiveSheet to NewSheet
' go to next row
End If
Next

Any takers?
__________________
Many shoes,

Jamez/SiliconFuRy
 
Old October 25th, 2004, 09:20 AM
Authorized User
 
Join Date: Oct 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to SiliconFuRy
Default

*Waits to be hit over the head with a large Excel manual*






Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar in row of Datagrid Except Header Row Theone84 ASP.NET 2.0 Professional 0 August 11th, 2008 12:10 AM
To retrieve a row by giving row number prad_a MySQL 1 March 22nd, 2007 11:20 PM
Read a column and Search Row by Row in another col AyatKh Excel VBA 2 January 26th, 2005 12:02 PM
Row blinking or Row Red mateenmohd Classic ASP Basics 4 January 26th, 2005 05:40 AM
Manage data row by row in datagrid Dragonist Classic ASP Databases 5 July 29th, 2004 04:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.