Finding Column Index value in Excel

Fine the reason is there is no ASCII code for AG combined together we have for A and G in separate but here we are trying to get them together probably with value 100 but ascii for 100 is d
Thats the reason why it was not getting us the right cell position

so lets do one thing
–First lets get the cell position
out_cell = OhioCashBS770.Columns.IndexOf(State)
where out_cell is a int32 value
so it will be like out_cell = 32

–then another assign activity
out_cellsub = (out_cell - 26)+1
where out_cellsub is a int32 variable
so it would be like
out_cellsub = 33 - 26
out_cellsub = 7

–now final assign activity be like this
in_cellposition = Convert.ToChar(65) + Convert.ToChar(64 + out_cellsub)
where in_cellposition is a string variable
so the output will be like
in_cellposition = ‘A’ + Convert.ToChar(64 + 7)
in_cellposition = ‘A’ + ‘G’
in_cellposition = “AG”

–Now finally inthe cell range mention as
in_cellposition + Convert.ToString(OhioCashBS770.Rows.IndexOf(row)+2)

this will be now AG+somerownumber in string

hope this would help you
kindly correct me if i m wrong and let know for any queries or clarification
Cheers @RPANovice1

6 Likes