Thread
:
appending records
View Single Post
#
2
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_]
external usenet poster
Posts: 414
appending records
Hi Michael
You don't have to select or activate either sheet:
Dim eRow As Long
eRow = Sheets("Sheet2").Cells(Rows.Count, 2).End(xlUp).Row + 1
Sheets("Sheet1").Range("A2:D100").Copy _
Sheets("Sheet2").Cells(eRow, 1)
With regard to removing duplicates you will need to give some more
detail. If you have two records with the same value (or is it text?) in
column B which do you want ot keep? Or do you want to add the values
from the other columns so that the records are consolidated?
Hope this helps
Rowan
wrote:
Here is my question:
I've got the code to do the following:
Sheets("Sheet1").Select
Range("A2:D100").Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
Pretty straight forward. It copies data from Sheet1 to Sheet2.
But when it's time to copy new data, I need to append it to the end of
sheet2, not put it in the active cell.
1. How would one go about doing that?
2. Also, how could I check for duplicates BEFORE copying to sheet2.
Basing a duplication as only havve duplicate entries for columns B and
C. Regardless of what's in Columns A and D.
Probably should use Worksheet("sheetnumber").Activate instead of
Sheets("sheetnumber").Select.
Thanks.
-Michael
Reply With Quote
Rowan Drummond[_3_]
View Public Profile
Find all posts by Rowan Drummond[_3_]