Help to fill fomula with conditions to last column

nhnn1986

Board Regular
Joined
Oct 12, 2017
Messages
92
Hi all:

I have excel file with sheet(result") and alot of sheets("ABCxxxxxxxx") with xxxxxxxx is number, the number of sheets("ABCxxxxxxxx") dynamic

Now I want to fill in some fomula from column E to last column that row(1) have data by macro with conditions that:

Code:
Each Cell(1,i) in range(cells(1,5),cells(1,lastcolumn)), i = 5 to lastcolumn
     if Cells(1,i).Value = right(sheets(j).name,8).Value then
          Cells(5,i).fomula =+SUMIF(sheets(j)!$B$2:$B$1931;"R-2110";sheets(j)!$K$2:$K$1931)+SUMIF(sheets(j)!$B$2:$B$1931;"R-2110";sheets(j)!$O$2:$O$1931)
          Cells(6,i).fomula =+SUMIF(sheets(j)!$B$2:$B$1931;"R-1213";sheets(j)!$K$2:$K$1931)
     End if
Next cells

https://imgur.com/a/JqMaMbX
All Fomula that I need look like the image I attach, please help me. Many thanks./.
JqMaMbX
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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