How to copy (with a macro) formulas from a row down based on if values exist an that row on another tab.

exPERten

New Member
Joined
Jun 23, 2020
Messages
19
Office Version
  1. 2016
Platform
  1. Windows
Hello again.

I need to copy a row of formulas from a specific row (Row 16) down but only if there is data in a specific filed on another tab.

To explain a little bit better.
Some people fill in data on a specific tab (Tab 2)
Other people fill in data on tab 4

My formulas concatinate and/or copies that data in tab 5

The problem is that sometimes there are only 20 rows of data, and sometimes there are 9999 rows.

If I copy the formulas down manually the file gets to large to be able to send as a mail.
So I would like to be able to add a macro that copies the formulas down to the last row of data based on another tab.

Thanks in advance.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
You could loop through the worksheets you would like to look at and run an if statement to see if the last row is a greater than the current last row number, once you have looped through each sheet, you will have a variable which will be the row you want to copy down. Then just run another for loop form i=1 to last row.

Basically,

for each ws in sheets
if Range("A1000000").end(xlup) > LastRow then
LastRow = Range("A1000000").end(xlup).row
end if
next.

You should be left with LastRow = the largest row. Then run loop i = 1 to LastRow.

Hope this helps.
 
Upvote 0
That went a bit over my head to be honest.

What I want to do is check how many rows one of the columns on one worksheet has.
And then copy formulas in column A to AS from row 16 down to as many rows of data that specific worksheet had.

Thanks for bearing with me, though.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

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