With Range and AutoFill Question

nirvehex

Well-known Member
Joined
Jul 27, 2011
Messages
505
Office Version
  1. 365
Platform
  1. Windows
Hi, I have a simple with formula but it's not copying down correctly.

Code:
Sheets("WOs (DSP Only)").Select
With Worksheets("WOs (DSP Only)")


    With .Range("A2:A" & Lastrow)
    .Formula = "=L2&""-""&K2&""-""&Z2&""-""&X2"
    End With
    
    With .Range("B2:B" & Lastrow)
    .FormulaArray = "=PERCENTILE.INC(IF($A$2:$A$" & Lastrow & "=A2,$AF$2:$AF$" & Lastrow & "),.5)"
    End With
    
    
End With

A2 in the the .FormulaArray is supposed to continually progress as it's copied downward. It should go to A3, then A4, then A5, and so on. But it stays locked at A2.

Could anyone help with that please?

Thanks!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Have you tried using Autofill?
Code:
    With Worksheets("WOs (DSP Only)")

        With .Range("A2:A" & lastrow)
            .Formula = "=L2&""-""&K2&""-""&Z2&""-""&X2"
        End With

        With .Range("B2")
            .FormulaArray = "=PERCENTILE.INC(IF($A$2:$A$" & lastrow & "=A2,$AF$2:$AF$" & lastrow & "),.5)"
            .AutoFill Destination:=Range("B2:B" & lastrow), Type:=xlFillDefault
        End With

    End With
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

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