Save data to table list at another sheet?

Occasional Visitor

Hi... I have this code which I found it in youtube.


Sub Store_data()

Dim sourceSheet As Worksheet
Dim dataSheet As Worksheet
Dim nextRow As Long

Set sourceSheet = Sheets("Add New")
Set dataSheet = Sheets("Master Record")

nextRow = dataSheet.Range("A" & dataSheet.Rows.Count).End(xlUp).Offset(1).Row

' Input the form values into the master list table

dataSheet.Cells(nextRow, 1).Value = sourceSheet.Range("i4").Value
dataSheet.Cells(nextRow, 2).Value = sourceSheet.Range("i5").Value
dataSheet.Cells(nextRow, 3).Value = sourceSheet.Range("i6").Value
dataSheet.Cells(nextRow, 4).Value = sourceSheet.Range("i7").Value
dataSheet.Cells(nextRow, 6).Value = sourceSheet.Range("i8").Value
dataSheet.Cells(nextRow, 7).Value = sourceSheet.Range("i9").Value
dataSheet.Cells(nextRow, 9).Value = sourceSheet.Range("i10").Value

' Clear Data
sourceSheet.Range("i4").Value = ""
sourceSheet.Range("i5").Value = ""
sourceSheet.Range("i6").Value = ""
sourceSheet.Range("i7").Value = ""
sourceSheet.Range("i8").Value = ""
sourceSheet.Range("i9").Value = ""
sourceSheet.Range("i10").Value = ""

End Sub


Currently I have created 2 Sheet. One sheet for data entry form and the other is to store the data.

However, how can I store the data within existing table list.

I have tested and the data successfully paste, however the data not within table list. 










0 Replies