How to find the column index to "Write Cell" if you know the column name

I know that the name/header of the column is “ID”. I’m trying to write a value to a cell, but am unable to determine how to identify the column index using the name.


You could just use Write Range and it will update the values that changed, but maybe the Write Cell is the best approach for you… So I’m assuming you want the letter of the column.

To find the numerical index you can do this, I believe (if you have a data table):

Then, to get the letter, you can convert it to a Character like this:
Convert.ToChar(65+dt1.Columns.IndexOf(“ID”) ) (you may want to test it if it’s 65 or 64)

However, if you don’t have a data table, then you need to do a Ctrl+f to jump the cell that has ID.
Then, Read the Address field in top left will give you the range.

Hope this answers it.