How can i get the Cell address from excel given a row and column number for example
row 2 and col 3 should return C2... Please help
I'm using zero-based row and column index. So I had to adapt the code of prior answers to the following. It took some trial and error to get this right for all possible addresses i.E. A1, Z2, AA2, ZZ10, ...
public string GetAddress(int col, int row)
{
col++;
StringBuilder sb = new StringBuilder();
do
{
col--;
sb.Insert(0, (char)('A' + (col % 26)));
col /= 26;
} while (col > 0);
sb.Append(row + 1);
return sb.ToString();
}