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: 38
Default Copy an entire row based on value in one cell

APOLOGIES IF THIS IS A DUPLICATE POSTING - SYSTEM PROBLEMS!

Hello all

I hope you'll forgive me if this is answered somewhere in the archives, I've
looked right through but can't find anything and have time constraints.

I have working code that:
- cycles through a spreadsheet row by row
- if it finds a predetermined value anywhere in the row, it copies that
entire row to a new spreadsheet

the code is:

Sheets("Report data").Activate

firstRow = 1
lastRow = Range("A60000").End(xlUp).Row

For r = firstRow To lastRow

Set c = Rows(r).Find("Infrastructure") ****
If Not c Is Nothing Then
Rows(r).Copy
Sheets("Infrastructure").Activate
Range("A65000").End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
Range("A65000").End(xlUp).Offset(0, 0).PasteSpecial (xlPasteFormats)
Sheets("Report data").Activate
End If
Next r

Sheets("Infrastructure").Activate
Range("a1").Select
Application.CutCopyMode = False
Application.StatusBar = False


I need to amend it so that it only copies the row if the required value is
in Column I of the row (so excluding any where it appears elsewhere, say in
colum A).

Can I do this by amending the line marked **** ? I've tried lots of
variations without success.

As ever, thanks in advance for any responses.

SJB
 
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
Specify a row based on data from a cell to delete entire row..... Fadedmartinikiss Excel Discussion (Misc queries) 0 March 11th 09 08:39 PM
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. bertbarndoor Excel Programming 4 October 5th 07 04:00 PM
Copy entire row to another sheet based on a criteria Brig Siton Excel Discussion (Misc queries) 3 August 7th 06 09:04 PM
copy and insert entire row based on integer in column A Dave A Excel Programming 8 June 26th 06 02:18 AM
Formatting an entire row based on one cell colettey29 Excel Worksheet Functions 2 April 8th 05 02:47 AM


All times are GMT +1. The time now is 10:02 PM.

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"