Copy a range of Array Formula using a macro.

GAJITCS

Board Regular
Joined
Apr 21, 2015
Messages
66
I have seen a few articles here about copying an Array Formula using a macro, but none for copying multiple array formulas.

I have a part populated sheet where the number of rows can vary.
Columns A:J are populated.
Cells K6:AT6 contain a mixture of Formulas and Array Formulas. I need to be able to copy these, preferably in one go, from their location in row K, down to the last row populated in column J.

Is this possible?

Many thanks.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi

If I understand correctly you want to copy the formulas in K6:AT6 down for ex. till K100:AT100

Try using the Range.FillDown Method.
It will copy all the formulas (array or not) down.
 
Last edited:
Upvote 0
Hi

If I understand correctly you want to copy the formulas in K6:AT6 down for ex. till K100:AT100

Try using the Range.FillDown Method.
It will copy all the formulas (array or not) down.


Thank you.

I now have
Range("K6:AS39").Filldown

and this works for the specified rows, but I need to fill the number of rows without knowing how many there will be. Sometimes, row 39 may be the last row, at other times it could be row 10 or 1234.

How can I adjust this FillDown formula to compensate for those situations?
 
Upvote 0
hi

What you posted is equivalent to:

Code:
Dim lRow As Long

lRow = 39

Range("K6:AS" & lRow).FillDown

This means that you just have to know how to calculate lRow

If you have problems finding the right value for lRow post back.
In that case be clear about where the data ends:
- column J has some values and then empty cells. You want to fill the formulas till the row of the last cell in J with a value
or
- column J has formulas that can return a value or null strings. You want to fill the formulas till the row of the last cell in J with a value different from a null string
 
Upvote 0
Thank you everyone.

The following solved my problem.

Sub Fill_Down()
Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("K6:AS" & LastRow).FillDown
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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