views:

20

answers:

1

In visual basic code works as below

MyWorksheet.Range("A1:D1").Formula = "A1B2"

In excel it shows in

 A1 as A1B2
 B1 as A1B2
 C1 as A1B2
 D1 as A1B2 

what i want do

 A1 as A1B2
 B1 as A1B3
 C1 as A2B4
 D1 as A2B5

Thanks in Advance

A: 

In VBA it is:

For colNumber = 1 To 4
   Row.Cells(1, clNumber).Formula = "A" & colNumber & "B" & colNumber + 1
Next clNumber

In .Net it is:

for(int colNumber = 1; colNumber<=4; colNumber++)
   {
    MyWorksheet.Row.Cells(1, colNumber).Formula = "A" + colNumber + "B" + (colNumber + 1)
   }
David Relihan