-1

I have very big problem and i can't find answer for it. Maybe You can halp me.

  1. In Sheet "Intro" I have row (5), in wich are formulas: (i) C5(='Sheet1'!$A$1); (ii) I5(=OFFSET('Sheet1'!$A$1;17;1;1;)); (iii) In this row also is number of my tables line, i. e B5(=1). This number "1" is also a hyperlink to Sheet1.enter code here

  2. I have Macro, which every time automaticaly insert new row after last filled row, i. e. when i have filled 5 row and run my Macro, it inserts line 6. Therefore necessary to automatically fill this row with my formulas, that I mentioned above.

More specifically, the new row should be filled in like this: When new row is 6: (i) C6(='Sheet2'!$A$1); (ii) I6(=OFFSET('Sheet2'!$A$1;17;1;1;)); (iii) B6(=2). This number "2" is also a hyperlink to Sheet2. When new row is 7: (i) C7(='Sheet3'!$A$1); (ii) I7(=OFFSET('Sheet3'!$A$1;17;1;1;)); (iii) B7(=3). This number "3" is also a hyperlink to Sheet3. When new row is 8: (i) C8(='Sheet4'!$A$1); (ii) I8(=OFFSET('Sheet4'!$A$1;17;1;1;)); (iii) B8(=4). This number "4" is also a hyperlink to Sheet4.

And......

Maybe You can help me?

In advance thank you sincerely.

4

1 回答 1

0

由于您已经有一个宏,我会用一些额外的功能来扩展宏来处理这个问题。

通过 VBA,设置单元格的公式很简单。

Sub createRow()
    Dim i As Integer
    i = 5
    Dim sheetOffset As Integer
    sheetOffset = -4

    FillInRow i, sheetOffset
End Sub

Sub FillInRow(i As Integer, sheetOffset As Integer)
    Sheets("Intro").Range("C" & i).Formula = "=Sheet" & CStr(i + sheetOffset) & "A1"
    Sheets("Intro").Range("I" & i).Formula = "=OFFSET(Sheet " & CStr(i + sheetOffset) & "3!$A$1;17;1;1;"
End Sub

您应该仔细设置偏移量。

我无法理解您在“B”列中需要什么。但是看到这个例子我相信你可以扩展它。

如果这太模糊,请说出来,我可以详细说明。

于 2012-11-06T15:02:39.500 回答