Hi.
Still pretty new to VBA - I am trying to copy some data from one worksheet (Non-Continuous cells) to a table on another worksheet in the same workbook. Following some coding I have used on similar tasks (albeit not entering to a table) I have come up with the following coding:
Sub Reg_Calc_ToTable()
Dim src As Worksheet
Dimtbl As ListObject
Dim newrow As ListRow
Application.ScreenUpdating = False
Set src = ("Calculator - Regular")
Set dst = ("Regular Bets")
Set tbl = Ws.ListObjects("Reg_BetsTable")
Set ewrow = tbl.ListRows.Add
With newrow
dst.Cells(rw, "C") = src.Range("D7")
dst.Cells(rw, "D") = scr.Range("D8")
dst.Cells(rw, "E") = src.Range("D9")
dst.Cells(rw, "F") = scr.Range("D10")
Application.ScreenUpdating = True
End With
MsgBox "Data Transferred"
End Sub
I have tried to think logically - naming the sources and destinations and then identifying where teh source data is coming from and to which cells specifically it is going to.
However, I am immediately getting an error code relating to dimtbl As ListObject being invalid as it is outside its Type Block. I have no idea as to whether the rest of the code will work.
Can anyone help? I hope there is enough info here to make sense of what I am trying to do.
Thank you
Still pretty new to VBA - I am trying to copy some data from one worksheet (Non-Continuous cells) to a table on another worksheet in the same workbook. Following some coding I have used on similar tasks (albeit not entering to a table) I have come up with the following coding:
Sub Reg_Calc_ToTable()
Dim src As Worksheet
Dimtbl As ListObject
Dim newrow As ListRow
Application.ScreenUpdating = False
Set src = ("Calculator - Regular")
Set dst = ("Regular Bets")
Set tbl = Ws.ListObjects("Reg_BetsTable")
Set ewrow = tbl.ListRows.Add
With newrow
dst.Cells(rw, "C") = src.Range("D7")
dst.Cells(rw, "D") = scr.Range("D8")
dst.Cells(rw, "E") = src.Range("D9")
dst.Cells(rw, "F") = scr.Range("D10")
Application.ScreenUpdating = True
End With
MsgBox "Data Transferred"
End Sub
I have tried to think logically - naming the sources and destinations and then identifying where teh source data is coming from and to which cells specifically it is going to.
However, I am immediately getting an error code relating to dimtbl As ListObject being invalid as it is outside its Type Block. I have no idea as to whether the rest of the code will work.
Can anyone help? I hope there is enough info here to make sense of what I am trying to do.
Thank you