I am looking to apply a border to one cell using the Microsoft.Office.Interop.Excel library.
I am running a while-loop that is search for a empty cell within a certain column, once the cell is found I want to apply a border to it.
I know there many forums on this using Ranges, but I can't use the range functionality since I do not know what cell it is being applied to exactly.
My idea was:
(Excel.Range)xlWS.Cells[row,1].Borders.LineStyle = (Whatever Value);
Any advice? (besides links to other forums, I already looked through tons of forms)?
Hope this helps someone! Puts a thin line border around cell[row,column]!
This is based on jiverson's answer, but is much more concise for basic needs; simply create a range, get its Borders, and add a border to the bottom of the range:
Of course, you could add a border to the top and sides, too, using xlEdgeTop, xlEdgeLeft, and xlEdgeRight.
To each cell in range
To whole range
See this answer for more details.