ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto Autofill (https://www.excelbanter.com/excel-discussion-misc-queries/209898-auto-autofill.html)

jase

Auto Autofill
 
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?

Dave Peterson

Auto Autofill
 
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???

Jase wrote:

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?


--

Dave Peterson

ShaneDevenshire

Auto Autofill
 
Hi,

Maybe something like this

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

If this helps, please click the Yes button.
--
Thanks,
Shane Devenshire


"Jase" wrote:

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?



All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com