from this two input tables:
representing your data the first datatable SN-numbers are to update. Also the Excels cells should be updated:
dtDataOrigin.Columns.Cast(Of DataColumn).ToList().FindIndex(Function (x) x.ColumnName.Equals("SN-number"))
is looking for the index of the SN-nummber column
Chr(64+idxColSNNumber+1).toString
is a shortcut for mapping the columnindex to the corresponding Excel Columnletter
This part is iterating over origin datatable, retrieves the SN-Number info from second table and updates the iterated row SN.number:
doing the lookup/filtering:
dt1.AsEnumerable.Where(Function (x) x(“ID”).toString.Trim.Equals(row(“ID”).toString.Trim)).Single()(“SN-number”).toString
The messagebox is prototyping the relevant info that can be used for a write cell activity