macro help adding new entries to a list

largeselection

Active Member
Joined
Aug 4, 2008
Messages
358
Hey again,

I'm trying to write a macro. Basically I have a set of data that I download every week. It is always in the same format with an ID in the leftmost column.

Basically I want to just download the data and then run this macro and have it add the new data into a list.

So as an example the data download looks like this:

1abcde
2abdec
3foijwe
4oijiofj
5ijoijoi

where the ID is a number and the letters are other data in columns.

So I can copy that and put it into a file, but then next week I get this data:

3foiwef
4oijoijf
5oijoiji
6jfjwjjf
7iwiwiwi

I am wondering if there is a way I can put into a macro something that will have excel check the ID of the new data. If it's not in the existing list of IDs then add the entire row to the bottom of the list of my new chart.

So in this case since there are already IDs 3,4,5 it would only add the rows with 6 and 7 to my new list. So my new list would be the original list plus rows 6 and 7 from this week:

1abcde
2abdec
3foijwe
4oijiofj
5ijoijoi
6jfjwjjf
7iwiwiwi

That's the first step. So if there is a solution to this I may have other questions to follow.

Thanks for your help!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Assuming that the new list is on Sheet1 and the accumulated list is on Sheet2 try

Code:
Sub Cpy()
Dim LR1 As Long, LR2 As Long, i As Long
LR2 = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
With Sheets("Sheet1")
    LR1 = .Range("A" & Rows.Count).End(xlUp).Row
    For i = 1 To LR1
        If IsError(Application.Match(.Range("A" & i).Value, Sheets("Sheet2").Columns("A"), 0)) Then
            LR2 = LR2 + 1
            .Rows(i).Copy Destination:=Sheets("Sheet2").Range("A" & LR2)
        End If
    Next i
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,099
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top