Extract Data Based On The Same of Header From Multiple Sheet Into One Sheet

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,089
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all..
i have several sheets (sheet a, sheet b, sheet c. etc...) in one file ..i want extract data only cell B4,B5,B6,H42,H43 and H44 into one sheet based on the same name header....
this my layout :


Excel 2007
ABCDEFGH
1LAND OF REPORT
2JAYA CORPORATE
3
4Name ofBulding A
5Code ofXXXX
6Address ofSamara Street 2, Jkt
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42Land of MetersRp50
43Total ValueRp99.500
44Round valueRp100.000
a
Cell Formulas
RangeFormula
H44=ROUND(H43,-3)


expected result :


Excel 2007
ABCDEF
1Name ofCode ofAddress ofLand of MetersTotal ValueRound value
2Bulding AXXXXSamara Street 2, Jkt5099.500100.000
3Bulding BYYYYetc
master


someone would help me out this problem ..

m.susanto
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try:
Code:
Sub CopyRanges()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim ws As Worksheet
    For Each ws In Sheets
        If ws.Name <> "Master" Then
            ws.Range("B4:B6").Copy
            Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial Transpose:=True
            ws.Range("H42:H44").Copy
            Sheets("Master").Cells(Rows.Count, "D").End(xlUp).Offset(1, 0).PasteSpecial Transpose:=True
        End If
    Next ws
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try:
Code:
Sub CopyRanges()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim ws As Worksheet
    For Each ws In Sheets
        If ws.Name <> "Master" Then
            ws.Range("B4:B6").Copy
            Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial Transpose:=True
            ws.Range("H42:H44").Copy
            Sheets("Master").Cells(Rows.Count, "D").End(xlUp).Offset(1, 0).PasteSpecial Transpose:=True
        End If
    Next ws
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub

hi Mumps....working great!!
Thank you a lot....
 
Upvote 0
Try:
Code:
Sub CopyRanges()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim ws As Worksheet
    For Each ws In Sheets
        If ws.Name <> "Master" Then
            ws.Range("B4:B6").Copy
            Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial Transpose:=True
            ws.Range("H42:H44").Copy
            Sheets("Master").Cells(Rows.Count, "D").End(xlUp).Offset(1, 0).PasteSpecial Transpose:=True
        End If
    Next ws
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub

hi mumps....
for fields Land of Meters, Total Value, Round value (contains formula) the result is #Value !....
how to make the result is value...
 
Upvote 0
Are you saying you want to paste the value but not the formula?
 
Upvote 0
Try:
Code:
Sub CopyRanges()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim ws As Worksheet
    For Each ws In Sheets
        If ws.Name <> "Master" Then
            ws.Range("B4:B6").Copy
            Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, Transpose:=True
            ws.Range("H42:H44").Copy
            Sheets("Master").Cells(Rows.Count, "D").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, Transpose:=True
        End If
    Next ws
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
Just a suggestion for you ... when you respond to a post, you don't necessarily have to include a copy of the previous response. :)
 
Upvote 0
Try:
Code:
Sub CopyRanges()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim ws As Worksheet
    For Each ws In Sheets
        If ws.Name <> "Master" Then
            ws.Range("B4:B6").Copy
            Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, Transpose:=True
            ws.Range("H42:H44").Copy
            Sheets("Master").Cells(Rows.Count, "D").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, Transpose:=True
        End If
    Next ws
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
Just a suggestion for you ... when you respond to a post, you don't necessarily have to include a copy of the previous response. :)

thank you mumps..works.!!
you're really great man....
 
Upvote 0

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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