开发者

How to paste formula from visual basic to excel In relative

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开发者_如何学Python
 D1 as A2B5

Thanks in Advance


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)
   }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜