HowDoIExcel
New Member
- Joined
- Aug 12, 2015
- Messages
- 8
Hello helpful excelites,
I'm trying to create a macro that is able to pull through data that is not a duplicate(marked as red), into the current existing database, that will add it on the bottom where there are free rows. The 6th column is static and will have a unique identifier, and for testing purposes its in column 3 for the other worksheet. This will have to sort through about 22,000 rows so I'm looking for ways to speed up this code and make it more efficient.
Each row in the UniqueID column(3&6) will be filled always, other rows may not always be filled so I'm looking to use a static range (unless there is a better way that also always ensures that the entire relevant data set on that row is captured).
Sub Entry_Additions()
'Variables
Dim entry_row As Long, new_entry_row As Long, column_shifter As Long, testing_row As Long
empty_row = 1 'This will find the empty row for new entries to be placed into
entry_row = 2 'Will hold the row value of the will be entered data, this is used to pull from all the other columns
Application.ScreenUpdating = False
Sheets("NewEntries").Select
Do While Sheets("NewEntries").Cells(entry_row, 6).Value <> ""
Sheets("NewEntries").Cells(entry_row, 6).Select
If ActiveCell.Interior.color = RGB(255, 0, 0) Then
Sheets("NewEntries").Cells(entry_row, 6).Interior.color = RGB(255, 0, 0)
Else
Sheets("NewEntries").Range(Cells(entry_row, 1), Cells(entry_row, 10)).Copy 'This is just a random interval, more than enough to hold all the data in each row
empty_row = Sheets("Farmer Database").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Row
Sheets("Farmer Database").Cells(empty_row, 1).PasteSpecial
End If
entry_row = entry_row + 1
Loop
End Sub
If anyone has any idea how to make this more concise, that would be appreciated.
I'm trying to create a macro that is able to pull through data that is not a duplicate(marked as red), into the current existing database, that will add it on the bottom where there are free rows. The 6th column is static and will have a unique identifier, and for testing purposes its in column 3 for the other worksheet. This will have to sort through about 22,000 rows so I'm looking for ways to speed up this code and make it more efficient.
Each row in the UniqueID column(3&6) will be filled always, other rows may not always be filled so I'm looking to use a static range (unless there is a better way that also always ensures that the entire relevant data set on that row is captured).
Sub Entry_Additions()
'Variables
Dim entry_row As Long, new_entry_row As Long, column_shifter As Long, testing_row As Long
empty_row = 1 'This will find the empty row for new entries to be placed into
entry_row = 2 'Will hold the row value of the will be entered data, this is used to pull from all the other columns
Application.ScreenUpdating = False
Sheets("NewEntries").Select
Do While Sheets("NewEntries").Cells(entry_row, 6).Value <> ""
Sheets("NewEntries").Cells(entry_row, 6).Select
If ActiveCell.Interior.color = RGB(255, 0, 0) Then
Sheets("NewEntries").Cells(entry_row, 6).Interior.color = RGB(255, 0, 0)
Else
Sheets("NewEntries").Range(Cells(entry_row, 1), Cells(entry_row, 10)).Copy 'This is just a random interval, more than enough to hold all the data in each row
empty_row = Sheets("Farmer Database").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Row
Sheets("Farmer Database").Cells(empty_row, 1).PasteSpecial
End If
entry_row = entry_row + 1
Loop
End Sub
If anyone has any idea how to make this more concise, that would be appreciated.
Last edited: