Using a macro to copy formulas down until the last formatted border

SledDave

New Member
Joined
Sep 14, 2016
Messages
11
Hey guys,

I'm having trouble with a particular macro.

I want to copy the formulas in J4:S4 all the way down to the bottom of my table.
The problem is there are already macros to insert rows based on specific criteria within the table. This is the reason I am copying the formulas down.
So a macro that copies the formulas down to a specific cell won't work.
The last row in the table, however, is formatted with a bottom border.

Is there a way I can copy the formulas from the top of the table (J4:S4) to the last row that has a border (J330:S330 as of today)?

Thanks!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
This will fill the formulas from J4:S4 down to the last used row based on used cells in column A. You can change the column A to whatever column you want to use to determine the last used row.

Code:
[COLOR=darkblue]Sub[/COLOR] Phill_Phormulas()
    Range("J4:S4").AutoFill Destination:=Range("J4:S" & Range([COLOR=#ff0000]"A"[/COLOR] & Rows.Count).End(xlUp).Row)
End [COLOR=darkblue]Sub[/COLOR]
 
Last edited:
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