2009-06-19 2 views

Antwort

1

Das ist für mich scheint

Call rng.Clear 
Dim rngState As Range 
Set rngState = rng.Resize(nRowCount, nColumnCount) 
rngState.FormulaArray = "whatever_array_formula" 
rngState.Calculate 
0

Was zu arbeiten, dass das Array bereits ausgefüllt wurde:

Sub PasteArray(vTheArray As Variant) 
Dim rPasteHere As Range 

With ActiveWorkbook 
    Set rPasteHere = .Sheets("PayRoll").Range("A1").CurrentRegion 'Assign the region to use 
    With rPasteHere 
     .Clear 'Wipe the current region clean 
     Set rPasteHere = .Resize(UBound(vTheArray, 1) + 1, UBound(vTheArray, 2) + 1) 'Resize the region to your input 
     .FormulaArray = vTheArray 'Dump the array into the resized region 
    End With 
End With 
Set rPasteHere = Nothing 'Clean up! 
End Sub 

Denken Sie daran, dass Arrays sind nullbasiert , also die +1 in der .Resize-Funktion. Für meine Anwendung habe ich den Namen und die Reichweite des Blattes so codiert, dass natürlich rPasteHere für den Einzelnen bestimmt ist.

Verwandte Themen