Auto Autofill

  • Thread starter Thread starter Jase
  • Start date Start date
J

Jase

I want to autofill a formula down 17 rows, however my couln will be different
each time. Is their a way I can specify the distance to autofill with out
putting in the column exactly.

Heres my code so far:
Do
If IsEmpty(DestCell.Value) Then
Exit Do
Else
Set DestCell = DestCell.Offset(0, 1)
End If
Loop

DestCell.FormulaR1C1 = "=RC[-2]-RC[-1]"
ActiveCell.Select
Selection.AutoFill Destination:=

any suggestions?
 
Can you use a certain row to determine the next available column? I like to
start at the far right and come back to the last used column, then come to the
right one column:

Dim Destcell as range
with worksheets("sheet9999")
set destcell = .cells(1,.columns.count).end(xltoleft).offset(1,0)
end with
destcell.resize(17,1).formular1c1 = "=RC[-2]-RC[-1]"

If you can't use the .end(xltoleft), then the destcell.resize(17,1) may be all
you need???
I want to autofill a formula down 17 rows, however my couln will be different
each time. Is their a way I can specify the distance to autofill with out
putting in the column exactly.

Heres my code so far:
Do
If IsEmpty(DestCell.Value) Then
Exit Do
Else
Set DestCell = DestCell.Offset(0, 1)
End If
Loop

DestCell.FormulaR1C1 = "=RC[-2]-RC[-1]"
ActiveCell.Select
Selection.AutoFill Destination:=

any suggestions?
 
Hi,

Maybe something like this

Selection.AutoFill Destination:=Range(Selection, Selection.Offset(16, 0))

If this helps, please click the Yes button.
 
Back
Top