End result desired: Use a macro to select a range of cells (D530:O530, then D531:O531, down to 1029) and "convert" the standard function into an array.
Rather than hitting F2 and CSE 500 times, I figured there should be an easy way to have Excel do the lifting.
I recorded a macro for the first couple lines (as an example) and attempted to then repeat that operation 500 more times.
Sub ArrayUpdateLoop()
'
' ArrayUpdateLoop Macro
'
Range("D530:O530").Select
For i = 1 To 500
Range("D530:O530").Select
ActiveCell.Offset(1, 0).Select
Selection.FormulaArray = "=Spreader(Rollouts,R[-503]C:R[-503]C[14])"
Next
End Sub
The above is my proposed/modified code using a loop, which seems to run, but doesn't actually perform the operation.
This is my first time using a loop to redo an operation X number of times, and I've not found much of the MS documentation/etc. terribly helpful.
Appreciate any feedback or help :-)
You need to offset by one row down in each loop:
Sub OffsetDown()
Dim i&, rng As Range
'// Start from the row above to line up with loop
Set rng = Range("D529:O529")
For i = 1 to To 500
Set rng = rng.Offset(1) '//Move one cell down
rng.FormulaArray = ...
Next
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.