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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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