AutoFill Help VBA

Felix_Dragonhammer

Board Regular
Joined
Apr 7, 2015
Messages
117
Here's my code:

Code:
Sub SKUTrackingSheetUpdate()
Sheets("SKU Tracking Sheet").Select
Range("Y2") = Range("Y2") + 1
ColToRef2 = Range("Y2").Value
ColToRef3 = Range("Z2").Value
    For n = 7 To 183 Step 22
        Cells(n, ColToRef2).Select
        Selection.AutoFill Destination:=Range(Cells(n, ColToRef2), Cells(n, ColToRef3)), Type:=xlFillDefault
    Next n
Cells(249, ColToRef2).Select
Selection.AutoFill Destination:=Range(Cells(249, ColToRef2), Cells(249, ColToRef3)), Type:=xlFillDefault
End Sub

The problem is is that the AutoFill is not AutoFilling. From what I can see, the active cell just cycles through the cells defined by ColToRef's and For n=7 to 183 Step 22.

Any help resolving this would be appreciated!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,215,030
Messages
6,122,762
Members
449,095
Latest member
m_smith_solihull

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