Copying Range From Multiple Worksheets Pasting Into One

bennhrios9

New Member
Joined
Sep 28, 2021
Messages
11
Office Version
  1. 2016
Platform
  1. Windows
Can someone please help me copy a specific range from multiple worksheet and paste it into one worksheet? The worksheets are formatted identically. I need the ranges B11:B24 and C11:C24 of each worksheet to be pasted on a new worksheet. Also, I need D5 of each worksheet to replace C11 in the new worksheet.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
How do you want range B11:B24 and C11:C24 from each worksheet to be copied into one sheet? Where and how you wanted those multiple ranges to be located?
 
Upvote 0
How do you want range B11:B24 and C11:C24 from each worksheet to be copied into one sheet? Where and how you wanted those multiple ranges to be located?
So, these two ranges of each sheet could just be next to each other going across the rows in the new worksheet. Looking like the screenshot below. (Example: B11:B24 and C11:C24 would be columns A and B in the new sheet.)
ExcelScreenshot.PNG
 
Upvote 0
VBA Code:
Sub CopyColumns()

Dim Source As Worksheet
Dim Destination As Worksheet
Dim Last As Long

Application.ScreenUpdating = False

Set Destination = Worksheets("Sheet1")

Destination.Name = "Sheet1"

'Looping through the worksheets in the workbook
For Each Source In ThisWorkbook.Worksheets
    
    
    If Source.Name <> "Sheet1" Then
        
        'Finding the last column from the destination sheet
        Last = Destination.Range("A1").SpecialCells(xlCellTypeLastCell).Column
        
        If Last = 1 Then
            'Pasting the data in the destination sheet
            Source.Range("B11:C24").Copy Destination.Columns(Last)
        Else
            Source.Range("B11:C24").Copy Destination.Columns(Last + 1)
        End If
    End If
Next

Columns.AutoFit

Application.ScreenUpdating = True

End Sub


The above will do what you are needing. However ... I don't understand the C5 - C11 request.
 
Upvote 0
Solution
VBA Code:
Sub CopyColumns()

Dim Source As Worksheet
Dim Destination As Worksheet
Dim Last As Long

Application.ScreenUpdating = False

Set Destination = Worksheets("Sheet1")

Destination.Name = "Sheet1"

'Looping through the worksheets in the workbook
For Each Source In ThisWorkbook.Worksheets
   
   
    If Source.Name <> "Sheet1" Then
       
        'Finding the last column from the destination sheet
        Last = Destination.Range("A1").SpecialCells(xlCellTypeLastCell).Column
       
        If Last = 1 Then
            'Pasting the data in the destination sheet
            Source.Range("B11:C24").Copy Destination.Columns(Last)
        Else
            Source.Range("B11:C24").Copy Destination.Columns(Last + 1)
        End If
    End If
Next

Columns.AutoFit

Application.ScreenUpdating = True

End Sub


The above will do what you are needing. However ... I don't understand the C5 - C11 request.
Wow! Thank you so much! It worked, that's amazing.
 
Upvote 0
This will loop through all sheets ans skip the sheet named "Summary" where the compiled data resides.
Add sheet name you want to skip.
VBA Code:
Sub CollectData()

Dim n As Long
Dim ws As Worksheet, wsSummary As Worksheet

Application.ScreenUpdating = False

Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Summary"
Set wsSummary = Sheets("Summary")

n = 0
For Each ws In ActiveWorkbook.Sheets
    Select Case ws.Name
        Case "Summary"
            ' Do Nothing if sheet name matches
        Case Else
            ws.Range("B11", "C24").Copy wsSummary.Range("A1").Offset(0, n)
            n = n + 2
    End Select
Next

End Sub
 
Upvote 0
What manipulations need to be done to the above code if instead of just a normal "Paste" a "Paste Value" is needed???
 
Upvote 0
What manipulations need to be done to the above code if instead of just a normal "Paste" a "Paste Value" is needed???
I presumed you want to keep the number formatting

VBA Code:
Sub CollectData()

Dim n As Long
Dim ws As Worksheet, wsSummary As Worksheet

Application.ScreenUpdating = False

Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Summary"
Set wsSummary = Sheets("Summary")

n = 0
For Each ws In ActiveWorkbook.Sheets
    Select Case ws.Name
        Case "Summary"
            ' Do Nothing if sheet name matches
        Case Else
            ws.Range("B11", "C24").Copy
            wsSummary.Range("A1").Offset(0, n).PasteSpecial (xlPasteValuesAndNumberFormats)
            n = n + 2
    End Select
Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,959
Members
452,539
Latest member
delvey

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