Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Entire rows with a difference


Hi Tom

I run this and it looks like it is all working fine.

I turned screen updating on so that I could see it.

It seems to run and copy the row. But when it finishes..there i
nothing on sheet 3.

I am also a little concerned that it appears to be making actions i
rows 50000 + when the sheet only has 500 lines on it
any ideas ?

Thanks

Davi

--
DB10
-----------------------------------------------------------------------
DB100's Profile: http://www.excelforum.com/member.php...nfo&userid=917
View this thread: http://www.excelforum.com/showthread.php?threadid=27829

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Entire rows with a difference

This worked for me:

Sub UniqueList()
'Build a new unique list from two other lists.
'Works by checking list 1 for missing values in list 2.
'Note: List 1 cannot contain duplicates, but list 2 can!
'Standard Module code!
'Sheet1 is the master list of names.
'Sheet2 is the Raw data.
'Sheet3 gets the names that are in the raw data but not on the master List!

Set MyFunction = Application.WorksheetFunction
Set MyRange1 = Sheets("Sheet1").Range("A2:A5000")
Set MyRange2 = Sheets("Sheet2").Range("A2:A5000")
Set MyResults = Sheets("Sheet3").Range("A2")
On Error GoTo myFin

'Loop for list values.
'Sheets("Sheet1").Select
For Each cell In MyRange2
If IsEmpty(cell) Then GoTo myFin
'Sheets("Sheet2").Select
If MyFunction.CountIf(MyRange1, cell.Value) = 0 Then
'Sheets("Sheet3").Select
cell.EntireRow.Copy
MyResults.Offset(r, 0).PasteSpecial xlValues
r = r + 1
End If
Next cell

myFin:
Sheets("Sheet3").Select
Sheets("Sheet3").Range("A1").Select

End Sub

--
Regards,
Tom Ogilvy

"DB100" wrote in message
...

Hi Tom

I run this and it looks like it is all working fine.

I turned screen updating on so that I could see it.

It seems to run and copy the row. But when it finishes..there is
nothing on sheet 3.

I am also a little concerned that it appears to be making actions in
rows 50000 + when the sheet only has 500 lines on it
any ideas ?

Thanks

David


--
DB100
------------------------------------------------------------------------
DB100's Profile:

http://www.excelforum.com/member.php...fo&userid=9176
View this thread: http://www.excelforum.com/showthread...hreadid=278296



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
copy entire rows to another sheet amjad_bang Excel Worksheet Functions 2 July 18th 10 08:02 PM
Copy Entire rows with a difference DB100[_21_] Excel Programming 1 November 15th 04 03:12 PM
how to copy entire row into next row john_liu Excel Programming 2 September 22nd 04 02:17 PM
How to copy entire row into next row by macro john_liu Excel Programming 1 September 22nd 04 07:10 AM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


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