VBA copy data to formatted table while inserting new rows

huzzle3

New Member
Joined
Feb 11, 2022
Messages
1
Office Version
  1. 2021
Platform
  1. MacOS
Hi!
If someone could help me create a VBA code for this, I would really appreciate it! I need to find data on sheet "Report" and copy it to sheet "Table 1".
"Table 1" is pre-formatted. In column A are the Panel Types. I need all P** (P01, P02... etc.) panels from "Report" to be copied to "Table 1" under row "Panel (P), then all B** (B01, B02... etc.) panels to be copied to "Table 1" under row "Braced (B)" and so on. I am only interested in the first 8 columns, so columns A-H. In "Table 1" new row need to be inserted of course.
I have manually copied panel P01 in place for an example.

The data in "Report" can change, the number of each type of panels (01, 02.. etc) can change, and sometimes a type of panel is zero so it is not in the list.
Can this be done? Thank you!

Copy data test.xlsm
ABCDEFGH
1Panel TypeQty.WidthHeightThicknessArea (m²)AngleWeight (kg)
2
3
4Panel (P)
5P011120026004003.12174.5
6SUBTOTAL13.12174.5
7
8Braced (B)
9
10SUBTOTAL00.000.0
11
12Column (C)
13
14SUBTOTAL00.000.0
Table 1
Cell Formulas
RangeFormula
B6,H14,F14,B14,H10,F10,B10,H6,F6B6=SUM(B4:B5)


Copy data test.xlsm
ABCDEFGHIJ
1ItemCodeQuantityWidthHeightThicknessBilled Area in m2DegkgX1X2
2345
3B01280027004004.3252590.7601520.864
4B026800260040012.485751.80.7306080.832
5B03180023004001.845112.40.6419160.736
6B04280021904003.5045215.60.6095720.701
7B05160021004001.26581.90.4242920.504
8B06480019104006.11253680.5262720.611
9C01139730004001.19191.60.380630.476
10C02136130004001.083860.3395160.433
11C03138026004000.98877.80.3112040.395
12C04440017754002.84221.60.2260680.284
13P011120026004003.12174.51.138821.248
14P02196926004002.519145.10.9068341.008
15P03194026004002.444141.40.877840.978
16P04192026004002.392138.70.8575360.957
17P05280026004004.16232.60.7592120.832
18P06172026004001.872106.10.6789880.749
19P07170026004001.82103.60.658680.728
20P08152926004001.37581.60.4866140.55
21P09280023004003.68208.40.668340.736
22P10145021004000.945590.3259040.378
23P11164212004000.7747.90.268460.308
24P12161912004000.74346.40.258170.297
25P1319909004000.89156.40.3094040.356
26P1416409004000.57636.50.1994720.23
Report
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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