Autofill Filldown issue VBA

Kelpot86

New Member
Joined
Aug 23, 2013
Messages
14
Hi,

I have 'Master' formulas in I1:Q1, all are formulas except col. O which has a static number that I wish to be copied down. The vba copies the 'master' formulas and pastes formulas into I9:Q9 to then populate to end of data based on data in col G.

Autofill is working well for the formulas but is filling the static number in incrementally e.g should be 6 on every row and is filling it as 6,7,8,9...). I have read that Filldown will stop this.

However, I am struggling to work out how to convert this vba code to Filldown. Also, if I am successful, will it still work with the formulas or will it just paste the same formula all the way down (e.g static formula =mid(A9,5,6) all the way down when I want the formula to move with the row = mid(A10,5,6), mid(A11,5,6) etc?

Code:
"Sub Copy_Formula()'
' Copy_Formula Macro
'
    Sheets("Deposit Accounting").Select
    Range("I1:Q1").Select
    Selection.Copy
    Range("I9:Q9").Select
    Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Selection.AutoFill Destination:=Range("I9:Q9" & Range("G" & Rows.count).End(xlUp).Row)
    Range(Selection, Selection.End(xlDown)).Select
End Sub"
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try
Code:
Sub Copy_Formula() '
' Copy_Formula Macro
'
    Sheets("Deposit Accounting").Select
    Range("I1:Q1").Copy Range("I9:Q9")
    Range("I9:Q" & Range("G" & Rows.Count).End(xlUp).Row).FillDown
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top