Hi folks,
Is there a way to auto-fill laterally across columns like there is down rows perhaps using a macro?
I was thinking this might be handy in some instances I've run into, but I'm not sure how to make the ActiveCell part work.
Is there a way to auto-fill laterally across columns like there is down rows perhaps using a macro?
I was thinking this might be handy in some instances I've run into, but I'm not sure how to make the ActiveCell part work.
VBA Code:
Sub FormulaFill()
'
Dim rng As Range
Dim y As Long
For Each rng In Range("B2:E2").Columns 'intended to autofill the formula below across cell (2) in columns B through E. Would be even better if it could just go to the last column that has data above it.
ActiveCell = Cells(1, y) 'this part doesn't work, but I assume I need to activate the cell to apply the formula so wanted to just loop through
ActiveCell.Formula2R1C1 = _
"=Formula Here()" ' I don't have a particular formula in mind
y = y + 1
Next rng
End Sub