When pasting data from one spreadsheet to another it drops data in the end of table but not last used cell

Excel_not_Knower

New Member
Joined
Jan 7, 2020
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I have a code which copies first column from spreadsheet and suppose to paste in master spreadsheet just below the last used row but it drops data in the end of table.
Pls can someone suggest how to make it work like I need?
It works fine when Paste range is not in table range but it's not a deal .
Table name SLJ_4

Sub Import_data()

Dim r1 As Excel.Range
Dim r2 As Excel.Range
Dim r3 As Excel.Range
Dim c As Excel.Range

Dim x As Date

Application.ScreenUpdating = False
Application.DisplayAlerts = False

Worksheets("Export").Activate
Range("A1").CurrentRegion.RemoveDuplicates Columns:=Array(1, 10), Header:=xlYes


Worksheets("Ticksheet_1").Activate

Set r1 = Range("A1").Resize(Range("A" & Rows.Count).End(xlUp).Row)
Set r2 = Worksheets("Export").Range("A2").Resize(Worksheets("Export").Range("A" & Rows.Count).End(xlUp).Row)
x = Now
For Each c In r2
Set r3 = r1.Find(What:=c.Value, MatchCase:=False, Lookat:=xlWhole)
If r3 Is Nothing Then
Range("A" & Rows.Count).End(xlUp).Offset(1).Value = c.Value
End If
Next
Debug.Print DateDiff("s", x, Now)

Sheets("Export_Dumb1").Delete
Sheets("Export_Dumb2").Delete

Application.ScreenUpdating = True
Application.DisplayAlerts = True

End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,910
Messages
6,175,320
Members
452,635
Latest member
laura12345

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