Fill down formulas

RattlingCarp3048

Board Regular
Joined
Jan 12, 2022
Messages
166
Office Version
  1. 365
Platform
  1. Windows
I posted a couple of weeks ago about filling down a formula using a macro and the solution provided was working great initially. Now that we have a few weeks of working data I realized the macro solution isn't working 100% and could use some help.

The formulas in R2-X2 are being copied down to the last row of data. Then the user edits columns v-x let's say row1789. Then we update the sheet adding more data spanning down to row3458. When using the macro to copy down the formulas in columns r-x to row 3458 it is removing the user edits in row 1789.

What I need it to do is when additional data is added to columns A-Q, look up column R to the last row with formulas and copy those formulas down to the last row. Here is the initial codes:

Lastrow = cells(rows.count, "a").end(xlup).row
Range(r2:x" & lastrow).formula = range("r2:x2").formula
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Since the new cells V-X to be filled are at the moment empty, maybe:
VBA Code:
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("R3:X" & lastRow).SpecialCells(xlCellTypeBlanks).Formula = Range("R2:X2").Formula
 
Last edited:
Upvote 0
Solution
Since the new cells V-X to be filled are at the moment empty, maybe:
VBA Code:
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("R3:X" & lastRow).SpecialCells(xlCellTypeBlanks).Formula = Range("R2:X2").Formula
This seems to work when I test it. Let me confirm tomorrow when the night shift users have a chance to test using current data and processes.
 
Upvote 0
Could also be:
VBA Code:
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
lastrowFormulas = Cells(Rows.Count, "R").End(xlUp).Row + 1
Range("R" & lastrowFormulas & ":X" & lastrow).Formula = Range("R2:X2").Formula
 
Upvote 0
Since the new cells V-X to be filled are at the moment empty, maybe:
VBA Code:
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("R3:X" & lastRow).SpecialCells(xlCellTypeBlanks).Formula = Range("R2:X2").Formula
This one worked like a charm! Thanks
 
Upvote 0
Even the second one looks good ;).
Thanks for the feedback, glad having been of some help.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,174
Members
449,071
Latest member
cdnMech

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