Hi.
I am trying to add data from one worksheet to a table in another worksheet. I have so far come up with the following code, but this is causing the data to sit underneath the table, rather than be added to the next empty row. Can someone please help to guide me as to how I identify the table itself? I have tried replacing the dst as ListObject and then identify the ListObject but that keeps returning a fault each time. The name of the table is "Reg_BetTable" in the Worksheet "Regular Bets"
Thank you in advance for any guidance.
Sub Add_Data_RegBets()
Dim src As Worksheet
Dim dst As Worksheet
Dim rw As Long
Application.ScreenUpdating = False
' Set source and destination sheets
Set src = Sheets("Calculator - Regular")
Set dst = Sheets("Regular Bets")
' Find next available row on destination sheet
rw = dst.Cells(Rows.Count, "C").End(xlUp).Row + 1
' Populate values on destination sheet
dst.Cells(rw, "C") = src.Range("D7")
dst.Cells(rw, "D") = src.Range("D8")
dst.Cells(rw, "E") = src.Range("D11")
dst.Cells(rw, "F") = src.Range("D10")
dst.Cells(rw, "G") = src.Range("G7")
dst.Cells(rw, "H") = src.Range("D12")
dst.Cells(rw, "I") = src.Range("D9")
dst.Cells(rw, "J") = src.Range("G8")
dst.Cells(rw, "K") = src.Range("G9")
dst.Cells(rw, "L") = src.Range("G12")
Application.ScreenUpdating = True
End Sub
I am trying to add data from one worksheet to a table in another worksheet. I have so far come up with the following code, but this is causing the data to sit underneath the table, rather than be added to the next empty row. Can someone please help to guide me as to how I identify the table itself? I have tried replacing the dst as ListObject and then identify the ListObject but that keeps returning a fault each time. The name of the table is "Reg_BetTable" in the Worksheet "Regular Bets"
Thank you in advance for any guidance.
Sub Add_Data_RegBets()
Dim src As Worksheet
Dim dst As Worksheet
Dim rw As Long
Application.ScreenUpdating = False
' Set source and destination sheets
Set src = Sheets("Calculator - Regular")
Set dst = Sheets("Regular Bets")
' Find next available row on destination sheet
rw = dst.Cells(Rows.Count, "C").End(xlUp).Row + 1
' Populate values on destination sheet
dst.Cells(rw, "C") = src.Range("D7")
dst.Cells(rw, "D") = src.Range("D8")
dst.Cells(rw, "E") = src.Range("D11")
dst.Cells(rw, "F") = src.Range("D10")
dst.Cells(rw, "G") = src.Range("G7")
dst.Cells(rw, "H") = src.Range("D12")
dst.Cells(rw, "I") = src.Range("D9")
dst.Cells(rw, "J") = src.Range("G8")
dst.Cells(rw, "K") = src.Range("G9")
dst.Cells(rw, "L") = src.Range("G12")
Application.ScreenUpdating = True
End Sub