Auto Autofill

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?
 
D

Dave Peterson

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?
 
S

ShaneDevenshire

Hi,

Maybe something like this

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

If this helps, please click the Yes button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top