Paste to bottom of a table

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,341
Office Version
  1. 365
Platform
  1. Windows
I have this code which will take the selection and Paste it in A2

Sheets("3 Source Selection").Range("C" & ActiveCell.Row & ":" & "D" & ActiveCell.Row).Copy
Sheets("Selected CostSource").Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

How do I modify this so that it paste it to the bottom of the table? My table starts in A1 on Selected CostSource

Code:
Sub SelectCostSourceData()

'***************************************
'Refresh Query to get unique ID and Rev
'***************************************

Application.ScreenUpdating = False

    Sheets("3 Source Selection").Visible = True



    Dim sh97 As Worksheet
    Dim tblSourceList As ListObject
    Dim Lastrow As ListRow
    Dim SCR As Variant
    Dim FND As Variant
    Dim LR9 As Long
    
    Set sh9 = Sheet9
    Set tblSourceList = sh9.ListObjects("CostSource_Selections")

    LR9 = Cells(Rows.Count, "B").End(xlUp).Row

If Intersect(ActiveCell, Range("B16:AJ" & LR9)) Is Nothing Then
    MsgBox "You must select a Cost Source in column E (VendorName).  Select a valid Cell, then click Select"
    Exit Sub
End If

Sheets("3 Source Selection").Range("C" & ActiveCell.Row & ":" & "D" & ActiveCell.Row).Copy
Sheets("Selected CostSource").Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        
    Application.CutCopyMode = False

'deactivated while coding
'Sheets("Selected Part").Visible = xlSheetVeryHidden

 '   With ThisWorkbook
 '        Sheets("3 Source Selection").ListObjects(2).QueryTable.Refresh BackgroundQuery:=False
  '   End With
     



         Sheets("3 Source Selection").Select
         Range("C10").Select


    
Application.ScreenUpdating = True

'UserForm1.Show
    
End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
I think I got it

Code:
Sub SelectCostSourceData()

'***************************************
'Refresh Query to get unique ID and Rev
'***************************************

Application.ScreenUpdating = False

    Sheets("3 Source Selection").Visible = True



    Dim sh97 As Worksheet
    Dim tblSourceList As ListObject
    Dim Lastrow As ListRow
    Dim SCR As Variant
    Dim FND As Variant
    Dim LR9 As Long
    Dim LR9a As Long
    Dim LR9b As Long
    
    
    Set sh9 = Sheet9
    Set tblSourceList = sh9.ListObjects("CostSource_Selections")

    LR9 = Cells(Rows.Count, "B").End(xlUp).Row

If Intersect(ActiveCell, Range("B16:AJ" & LR9)) Is Nothing Then
    MsgBox "You must select a Cost Source in column E (VendorName).  Select a valid Cell, then click Select"
    Exit Sub
End If


    LR9a = Sheets("Selected CostSource").Cells(Rows.Count, "A").End(xlUp).Row
        LR9b = LR9a + 1
    
Sheets("3 Source Selection").Range("C" & ActiveCell.Row & ":" & "D" & ActiveCell.Row).Copy
Sheets("Selected CostSource").Range("A" & LR9b).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        
    Application.CutCopyMode = False

'deactivated while coding
'Sheets("Selected Part").Visible = xlSheetVeryHidden



         Sheets("3 Source Selection").Select
         Range("C10").Select


    
Application.ScreenUpdating = True

'UserForm1.Show
 
Upvote 0

Forum statistics

Threads
1,214,996
Messages
6,122,636
Members
449,092
Latest member
bsb1122

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