Hello There,
I have the below Sub which inserts a new row at the end of the table.
In the sub, there is On Error Resume Next. When this line of codeis enabled all goes okay
But when I disable On Error Resume Next, it pops up with an error: 'Runtime error '438' Object doesn't support this property or error.
The error popsup at Set Maxrr = O_MstTbl_Transactions.....
Could you please advice?
Thanks & regards,
Don
I have the below Sub which inserts a new row at the end of the table.
In the sub, there is On Error Resume Next. When this line of codeis enabled all goes okay
But when I disable On Error Resume Next, it pops up with an error: 'Runtime error '438' Object doesn't support this property or error.
The error popsup at Set Maxrr = O_MstTbl_Transactions.....
Code:
Sub TestInsertData()
Dim MstWSName_Transactions As Worksheet, MstTblName_Transactions As String, O_MstTbl_LastTransactionNumber As ListObject
Dim Maxrr As Range, MaxSrNumber As Integer
'On Error Resume Next
InitializeEnvironment
'Set Master Worksheet and Master Table for Transactions
Set MstWSName_Transactions = MstWB.Worksheets("Transactions")
MstTblName_Transactions = "Tbl_Transactions"
Set O_MstTbl_Transactions = MstWSName_Transactions.ListObjects(MstTblName_Transactions)
'Insert a new row at the start of the table
Set Maxrr = O_MstTbl_Transactions.DataBodyRange.Rows(O_MstTbl_Transactions.ListRows.Count)
MaxSrNumber = Intersect(Maxrr.EntireRow, O_MstTbl_Transactions.ListColumns("Sr.").DataBodyRange).Value + 1
O_MstTbl_Transactions.ListRows.Add (O_MstTbl_Transactions.ListRows.Count + 1)
Set Maxrr = O_MstTbl_Transactions.DataBodyRange.Rows(O_MstTbl_Transactions.ListRows.Count + 1).Add
'Keep adding values to the new row
Intersect(O_MstTbl_Transactions.ListColumns("Sr.").DataBodyRange, Maxrr.Offset(1)).Value = MaxSrNumber
Intersect(O_MstTbl_Transactions.ListColumns("Legal Entity Number").DataBodyRange, Maxrr.Offset(1)).Value = EntWSDE_Header.[FLegalEntityNumber]
End Sub
Could you please advice?
Thanks & regards,
Don