macro copy paste multiple worksheets

kkath

New Member
Joined
Jan 30, 2023
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hi. I have a spreadsheet that has different worksheets. From each worksheet there are rows of data from cell F4:F26 to AD4:AD26.

I want to copy this row from each worksheet into a single worksheet.

Asking for a help on how I can build a macro to put it in a single sheet please.

Appreciate for your kind help in advance. Thank you
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to the Board!

What is the name of the sheet you want to copy this data to?
What cell address should the first entry be pasted to (especially which column, are you wanting to paste TO column F or column A)?
Will every row between rows 4-22 on each sheet ALWAYS have data in it? If not, do we want to skip the blank lines, or copy them over to?
 
Upvote 0
Welcome to the Board!

What is the name of the sheet you want to copy this data to?
What cell address should the first entry be pasted to (especially which column, are you wanting to paste TO column F or column A)?
Will every row between rows 4-22 on each sheet ALWAYS have data in it? If not, do we want to skip the blank lines, or copy them over to?
1. "Master" will do. Maybe i can change it later on?
2. I want to paste it to column D.
3. Yes there is data in between, but the on the last row where no data iwant ti skip it

Here is the sample i want to copy sir. This worbook has 10 sheets, same column F-AD and row 4-26. I want to copy datas from row 4-26 of each sheet, if there is blank from F4-f26 maybe can skip.
1675107449604.png
 
Upvote 0
1. "Master" will do. Maybe i can change it later on?
2. I want to paste it to column D.
3. Yes there is data in between, but the on the last row where no data iwant ti skip it

Here is the sample i want to copy sir. This worbook has 10 sheets, same column F-AD and row 4-26. I want to copy datas from row 4-26 of each sheet, if there is blank from F4-f26 maybe can s
 
Upvote 0
correction: 2. paste it to column F i should say
 
Upvote 0
Try this:
VBA Code:
Sub MyCopyData()

    Dim ws As Worksheet
    Dim lr As Long
    
    Application.ScreenUpdating = False
    
'   Loop through all sheets
    For Each ws In ActiveWorkbook.Sheets
'       Skip "Master" sheet
        If ws.Name <> "Master" Then
'           Find last row with data in column F
            With ws
                lr = .Cells(.Rows.Count, "F").End(xlUp).Row
'               Copy data from sheet to "Master" sheet
                ws.Range("F4:AD" & lr).Copy Sheets("Master").Cells(Rows.Count, "F").End(xlUp).Offset(1, 0)
            End With
        End If
    Next ws
    
    Application.ScreenUpdating = True
    
    MsgBox "Copy complete!"
    
End Sub
 
Upvote 0
Solution
Hi sir. It's not working. Can you help me with step by step process. Maybe i just need to click something other than copying the code in VBA and running macro.
 
Upvote 0
Also sir, how about if there are worksheets i don't want to include to copy to the single worksheet. Let's say from 10 sheets that i said previously, there are 4 more sheets on the left side which i dont want to include. How is it sir

See sample:
1675136566519.png
 
Upvote 0
Hi sir. It's not working. Can you help me with step by step process. Maybe i just need to click something other than copying the code in VBA and running macro.
I am guessing maybe you did not put the code in the correct place. You need to insert a new VBA module in your workbook and paste the code there.
See here for instructions: Insert and run VBA macros in Excel - step-by-step guide.

Also sir, how about if there are worksheets i don't want to include to copy to the single worksheet. Let's say from 10 sheets that i said previously, there are 4 more sheets on the left side which i dont want to include. How is it sir
There are a number of ways of doing this, some better than others.
What I think is most effective is if there is some pattern in the sheet names of the sheets you want to include or the ones you want to exclude.
For example, if all the ones you want to exclude start with the word "exclude".
Or all the ones you want to include contain the same word.
Do you have any such pattern?
If not, what are the exact names of the 4 sheets that you want to exclude?
 
Upvote 0
Thank you so much for your help sir. The code already works for me and I chose to not include anymore the 4 sheets before running macro already.
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,273
Members
449,220
Latest member
Excel Master

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