i have some vba code that i need to convert to c#
Select Case letter0
Case "A01"
Cells(rownum, 2).Value = "1"
Case "B01"
Cells(rownum, 2).Value = "2"
Case "C01"
Cells(rownum, 2).Value = "3"
Case "D01"
Cells(rownum, 2).Value = "4"
Case "E01"
Cells(rownum, 2).Value = "5"
Case "F01"
Cells(rownum, 2).Value = "6"
Case "G01"
Cells(rownum, 2).Value = "7"
Case "H01"
Cells(rownum, 2).Value = "8"
Case "A02"
Cells(rownum, 2).Value = "9"
Case "B02"
...
..
i understand how to do a switch on this, but is there an easier method?
i will not be checking CELLS(rownum.........) instead of will be doing switch(somestring)
is there an easier way to do this than explicitly write every single case?
Yes, it works (for your example at least). Assuming, of course, that
letter0is always in the format A99 – no validation included!Edit I guess the algorithm is a little bit clearer now…