Reputation: 2014
I have a cell with a formula. I want to autofill from that cell, to a fixed number of columns across.
I am trying something along the lines of this:
Selection.AutoFill Destination:=Range("RC:RC[+26]"), Type:=xlFillDefault
but can't get it right.
Thanks!
Upvotes: 0
Views: 1301
Reputation: 19847
You could use Resize
:
With ThisWorkbook.Worksheets("Sheet1")
.Range("A2").AutoFill Destination:=.Range("A2").Resize(, 26), Type:=xlFillDefault
End With
This will fill the formula from A2:Z2.
Upvotes: 3
Reputation: 5426
Try using Offset
inside a Range
command:
Selection.AutoFill Destination:=range(activecell, activecell.Offset(0,26)), Type:=xlFillDefault
The RC style is used in formulas, but I have never seen it used inside a Range
object.
Upvotes: 0