Split sheets into multiple sheets based on how many rows in cell value

abdo meghari

Well-known Member
Joined
Aug 3, 2021
Messages
531
Office Version
  1. 2019
Hello
I would split BRAND sheet into multiple sheets(BRAND1,BRAND2....) based on G2 cell(how many rows should be ignoring headers from numbers in G2 should show how many items for each sheet alone.
as example when write 4 then should show the headers in row1 and 4 items for each sheet and the last sheet will be 3 Items also insert TOTAL row to sum column F . if the G2 is empty doesn't do anything.
I don't want splitting sheets repeatedly when run the macro every time, just replace data .

AA
ABCDEFG
1ITEMCODEBRANDQTYUNIT PRICETOTALnumbers
211221BS 205/70R15C R623 THI62.00405.0025,110.004
321227BS 215/70R15C R623 THI22.00425.009,350.00
431227BS 215/70R15C R623 THI4.00544.002,176.00
541241BS 1200R20 G580 JAP220.002,035.00447,700.00
651284GC 1200R20 AZ0026 CHI80.00895.0071,600.00
761284GC 1200R20 AZ0026 CHI50.001,125.0056,250.00
871285GC 1200R20 AZ0183 CHI40.00925.0037,000.00
981285GC 1200R20 AZ0183 CHI10.001,225.0012,250.00
1091285GC 1200R20 AZ0183 CHI60.001,205.0072,300.00
11101385GC 315/80R22.5 AT161 CHI20.00735.0014,700.00
12111294GC 315/80R22.5 AZ188 CHI20.00745.0014,900.00
13121287GC 315/80R22.5 AZ126 CHI60.00735.0044,100.00
14131305BS 700R16 R230 JAP2.00770.001,540.00
15141306BS 750R16 R230 JAP10.00775.007,750.00
16151306BS 750R16 R230 JAP4.00780.003,120.00
17TOTAL819,846.00
BRANDS
Cell Formulas
RangeFormula
F2:F16F2=D2*E2
F17F17=SUM(F2:F16)



result
AA
ABCDEF
1ITEMCODEBRANDQTYUNIT PRICETOTAL
211221BS 205/70R15C R623 THI62.00405.0025,110.00
321227BS 215/70R15C R623 THI22.00425.009,350.00
431227BS 215/70R15C R623 THI4.00544.002,176.00
541241BS 1200R20 G580 JAP220.002,035.00447,700.00
6TOTAL484,336.00
BRAND1
Cell Formulas
RangeFormula
F2:F5F2=D2*E2
F6F6=SUM(F2:F5)



AA
ABCDEF
1ITEMCODEBRANDQTYUNIT PRICETOTAL
211284GC 1200R20 AZ0026 CHI80.00895.0071,600.00
321284GC 1200R20 AZ0026 CHI50.001,125.0056,250.00
431285GC 1200R20 AZ0183 CHI40.00925.0037,000.00
541285GC 1200R20 AZ0183 CHI10.001,225.0012,250.00
6TOTAL177,100.00
BRAND2
Cell Formulas
RangeFormula
F2:F5F2=D2*E2
F6F6=SUM(F2:F5)



AA
ABCDEF
1ITEMCODEBRANDQTYUNIT PRICETOTAL
211285GC 1200R20 AZ0183 CHI60.001,205.0072,300.00
321385GC 315/80R22.5 AT161 CHI20.00735.0014,700.00
431294GC 315/80R22.5 AZ188 CHI20.00745.0014,900.00
541287GC 315/80R22.5 AZ126 CHI60.00735.0044,100.00
6TOTAL146,000.00
BRAND3
Cell Formulas
RangeFormula
F2:F5F2=D2*E2
F6F6=SUM(F2:F5)



AA
ABCDEF
1ITEMCODEBRANDQTYUNIT PRICETOTAL
211305BS 700R16 R230 JAP2.00770.001,540.00
321306BS 750R16 R230 JAP10.00775.007,750.00
431306BS 750R16 R230 JAP4.00780.003,120.00
5TOTAL12,410.00
BRAND4
Cell Formulas
RangeFormula
F2:F4F2=D2*E2
F5F5=SUM(F2:F4)
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
It looks like you could do what you want with Pivot Tables?
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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