Hello There,
I am using two excel files.
File 1 for storing the data (as a Database) and
File 2 for data entry.
I am using the below code (in File 2) to update the corresponding table record in File 1.
In File 2, values of the range fields are as below:
EntWSDE_Header.[FStudentNumber] = 100
EntWSDE_Header.[FStudentName] = "Don"
In File 1, Table Column, it stores a value "#NAME?"
On debug, I see that it has an Error 2029
Could you please advise, how this can be resolved?
Many thanks & regards,
Don
I am using two excel files.
File 1 for storing the data (as a Database) and
File 2 for data entry.
I am using the below code (in File 2) to update the corresponding table record in File 1.
In File 2, values of the range fields are as below:
EntWSDE_Header.[FStudentNumber] = 100
EntWSDE_Header.[FStudentName] = "Don"
In File 1, Table Column, it stores a value "#NAME?"
On debug, I see that it has an Error 2029
Code:
Sub UpdateData()
Dim fnd As Range
Dim rngSearch As Range
Dim MstWB, EntWB As Workbook
Dim MstTblName_Transactions, EntWSName_Header As String
Dim MstWSName_Transactions, EntWSDE_Header As Worksheet
Dim O_MstTbl_Transactions As ListObject
On Error Resume Next
'Opens Master Workbook
Set MstWB = Workbooks.Open(Filename:=ABC.xlsx, ReadOnly:=False, Notify:=False)
'Set Master Workbook and Worksheet
Set MstWSName_Transactions = MstWB.Worksheets("Transactions")
MstTblName_Transactions = "Tbl_Transactions"
Set O_MstTbl_Transactions = MstWSName_Transactions.ListObjects(MstTblName_Transactions)
'Set Entry Workbook and Worksheet
Set EntWB = ThisWorkbook
EntWSName_Header = "Header"
Set EntWSDE_Header = EntWB.Worksheets(EntWSName_Header)
'Set Master Workbook Table Range and Search Value Student Number
Set rngSearch = MstWSName_Transactions.ListObjects("Tbl_Transactions").Range
Set fnd = rngSearch.Find(What:=EntWSDE_Header.[FStudentNumber].Value, LookIn:=xlValues, Lookat:=xlWhole)
'If record found in Master Table
'Assign Value from Entry to Master Worksheet Table
If Not fnd Is Nothing Then
'-----------------------------------------------------------------------------
'This is the assignment which updates Table Column "Student Name
'With a value #NAME?
'-----------------------------------------------------------------------------
Intersect(O_MstTbl_Transactions.ListColumns("Student Name").DataBodyRange, fnd.EntireRow).Value = EntWSDE_Header.[FStudentName]
....
.....
....
End if
End Sub
Could you please advise, how this can be resolved?
Many thanks & regards,
Don
Last edited: