2

どうすれば次のことができますか:

For j = 1 To MaxCol + 1
    'Select the cell on which you want to save the formula

    Cells(7, j).Select

    my_story_tab_array(j) = ActiveCell.FormulaArray
Next

アクティブ ワークシートの一部のセルは数式配列ではありません...一部は...

後で復元できるように、コード (パブリック/グローバル変数) の array() に保存したい...

ティア。

4

2 に答える 2

0

私はこれがあなたを助けると思います:)

    Sub editedmacro()
    Dim my_story_tab_array() As Variant 'Array where the formula will be store
    MaxCol = 2
    For j = 1 To MaxCol + 1
        ReDim my_story_tab_array(MaxCol + 1) 'set size of the array
        Cells(7, j).Select 'Select the cell on which you want to save the formula

        my_story_tab_array(j) = ActiveCell.FormulaArray 'store the current cell value into array
        MsgBox (my_story_tab_array(j))
    Next
   End Sub

よろしく

于 2013-07-10T06:57:43.617 に答える
0

sth を検索しています。このような:

Sub example()
With ActiveWorkbook.Sheets(1).Range(Cells(7, 3), Cells(7, 4))
    .Formula = "=SUM($A$2, $A$3) * 9"
    .FormulaArray = .FormulaR1C1
End With
End Sub

よろしく

于 2013-07-10T18:38:17.647 に答える