as you can see in the screenshot the coloumn expiry date comes two times the expiry dates are based on the passport and visa i need to rename the coloumn as Passport expiry date and Visa Expiry date i need final coloumn like this
i mean that in this sample excel i have given expiry date in A2 but it is not always like it may be in b2 ,c2 like that so is any way we can make it as dynamic
@Alan_Prakash1
by using below linq code you can serach dynamic column you will get the column index as output
(From row In dt_bankstatement.AsEnumerable(), col In dt_bankstatement.Columns.Cast(Of DataColumn)().Select(Function(c, index) New With {Key .Column = c, Key .Index = index}) Where row(col.Column).ToString().Contains(element_tosearch.Trim) Select col.Index).FirstOrDefault()