# Range definition

Hello, I have a question about the API documentation.
How can I define a range e.g BH2:BZ3 if the first column is represented for a byte value?

Cells.CreateRange Method (Int32, Byte, Int32, Int32)

[Visual Basic]
ByVal firstRow As Integer, _
ByVal firstColumn As Byte, _
ByVal rowNumber As Integer, _
ByVal columnNumber As Integer
_) As Range

Is thera a way to define a range using a string like this: “BH2:BZ3”?

Thank You

Hello

For range BH2:BZ3,

firstRow is 2-1 = 1 (zero based),

rowNumber is 3-2 + 1 = 2,

As B is the 2nd letter, H is the 8th leter and Z is 26th letter, so

firstColumn is 2 * 26 + 8 - 1 = 59

lastColumn is 2 * 26 + 26 - 1 = 77

columnNumber = 77 - 59 + 1 = 19

Finally you can create your range like this:

Cells.CreateRange(1, 59, 2, 19)

Cells.CreateRange(string firstCell, string lastCell)

Hello,
when you expect to have ready the new method Cells.CreateRange(string firstCell, string lastCell) ?

Meantime, perhaps you need to change the firstColumn Byte value for Integer value because for columns bigger than “KA” the index is bigger than 256.

K is 11th letter, zero based is number 10
then, 10 * 26 = 260 > 256

Thank You.
Alejandro

Dear Alejandro,