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: 4
Default Copy row to next empty line

Hi,

Very new to this so would be grateful for any help.

I'm trying to copy rows from one workbook to another when they meet a
certain criteria. But I do not want to overwrite previously copied
lines. I want to add new rows, that meet the criteria, to the end of
the older copied data.

Dont know whether its relevent but to make sure that lines that are
already on sheet 6 aren't duplicated, I have a lookup function in col
23 of sheet 1 that brings back the unique identifier if it is already
on sheet 6.

I know this is very convaluted!

Sub UnmatchedPOs()

Set rng = Sheets(1).Range("A:V").Rows

Set rngTo = Sheets(6).Range("A1").End(xlDown)

For Each r In rng
If r.Cells(3).Value = "NO" Then
If r.Cells(9).Value = DateValue("April, 01, 2007") Then
If r.Cells(9).Value < DateValue("April 01, 2008") Then
If Not r.Cells(6).Value = r.Cells(23).Value Then

i = i + 1
r.Copy rngTo(i)

End If
End If
End If
End If
Next

End Sub

When I run this I get:

1004 - Application defined or object defined error

Many Thanks,

Jig

 
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 Cell From Subtotal Line To Detail Line Tickfarmer Excel Discussion (Misc queries) 2 November 5th 09 02:40 PM
Hide the line when cell B is empty Christine Excel Discussion (Misc queries) 4 August 1st 08 05:25 PM
Clipboard empty but get cannot empty CB when trying to copy Peter @ ServiceMaster Excel Worksheet Functions 0 February 22nd 07 03:58 PM
Copy and Paste in the first empty available line. Etienne Excel Programming 5 August 3rd 06 03:49 PM
how to do sum when meet an empty line in vba tango Excel Programming 1 October 27th 04 10:45 AM


All times are GMT +1. The time now is 08:15 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"