admin管理员组文章数量:1415673
I want my entry data to be save continuously to last save cell this code overwrites the first save this is the code for my save written in vba module(macro) Sub Transfer()
Dim objList As ListObject ' ListObject to refer the Table created for Employee
Dim shForm As Worksheet 'Worksheet variable to refer Form
Set objList = ThisWorkbook.Sheets("KIT_ASSY").ListObjects("EmpTable") ' Assigning Employee Table
Set shForm = ThisWorkbook.Sheets("EGS DB") ' Assigning Form sheet to this variable
If objList.DataBodyRange(1, 1).Value <> "" Then ' Identifying whether row 1 is blank in current table or not
objList.ListRows.add Position:=1 'If row 1 is not blank in table then insert a new blank for at 1
End If
'Referring ObjList and transferring data to DataBodyRange of Table
With objList
.DataBodyRange(1, 1).Value = shForm.Range("h3").Value 'Reference #
.DataBodyRange(1, 2).Value = shForm.Range("b3").Value 'Reference #
.DataBodyRange(1, 3).Value = shForm.Range("c8").Value 'Reference #
.DataBodyRange(1, 4).Value = shForm.Range("d8").Value 'Reference #
.DataBodyRange(1, 5).Value = shForm.Range("g8").Value 'Reference #
.DataBodyRange(2, 1).Value = shForm.Range("h3").Value 'Reference #
.DataBodyRange(2, 2).Value = shForm.Range("b3").Value 'Reference #
.DataBodyRange(2, 3).Value = shForm.Range("c9").Value 'Reference #
.DataBodyRange(2, 4).Value = shForm.Range("d9").Value 'Reference #
.DataBodyRange(2, 5).Value = shForm.Range("g9").Value 'Reference #
End With
ThisWorkbook.Save 'Save this workbook
End Sub
Sub TransferToTable()
Dim iMessage As VbMsgBoxResult
iMessage = MsgBox("Do you want to transfer the data?", vbYesNo + vbQuestion, "Confirmation")
If iMessage = vbNo Then Exit Sub
Call Transfer
End Sub
本文标签: excel data entry overwrite first save problemStack Overflow
版权声明:本文标题:excel data entry overwrite first save problem - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745216137a2648177.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论