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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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