Extract data to another sheet layout

Goalexcel

Board Regular
Joined
Dec 28, 2020
Messages
101
Office Version
  1. 2016
Platform
  1. Windows
Hello Expert. Please kindly help to find out the best way ,maybe with VBA to extract data to another sheet layout report .
DataSheet1 no always has the same range A21 to N Layoutsheet2.PNGDatasheet1.PNG

Below the link to check the excel file Mar Pav sent you 1 item
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Sorry my fault. Try this:
VBA Code:
Sub TransformData()

Dim i As Long, j As Long, Lr1 As Long, K As Long, F As Long, Lr2 As Long

For j = 1 To Sheets.Count Step 2
Lr1 = Sheets(j).Cells(Rows.Count, 1).End(xlUp).Row
' if you want more you can change 10 to number of Data group added to each sheet
For i = 1 To 10 Step 2
K = (i + 1) * 6 / 2
Sheets(j + 1).Cells(K, 1).Value = "DATA"
Sheets(j + 1).Cells(K, 3).Value = "DATA"
Sheets(j + 1).Cells(K, 6).Value = "DATA"
Sheets(j + 1).Cells(K, 8).Value = "DATA"
 
Sheets(j + 1).Cells(K, 2).Value = Sheets(j).Cells(20, i) 'Header B6
Sheets(j + 1).Cells(K, 7).Value = Sheets(j).Cells(20, i + 1) 'header G6

Sheets(j + 1).Cells(K + 1, 1).Resize(4).ClearContents
Sheets(j + 1).Cells(K + 1, 1).Value = Sheets(j).Cells(21, i)
Sheets(j + 1).Cells(K + 2, 1).Value = Sheets(j).Cells(22, i)
Sheets(j + 1).Cells(K + 3, 1).Value = Sheets(j).Cells(23, i)
Sheets(j + 1).Cells(K + 4, 1).Value = Sheets(j).Cells(24, i)

Sheets(j + 1).Cells(K + 1, 6).Resize(4).ClearContents
Sheets(j + 1).Cells(K + 1, 6).Value = Sheets(j).Cells(21, i + 1)
Sheets(j + 1).Cells(K + 2, 6).Value = Sheets(j).Cells(22, i + 1)
Sheets(j + 1).Cells(K + 3, 6).Value = Sheets(j).Cells(23, i + 1)
Sheets(j + 1).Cells(K + 4, 6).Value = Sheets(j).Cells(24, i + 1)

Next i
Next j

End Sub
Thank you Dear @maabadi for your cooperation , works like a charm!!!!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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