Copy all sheets (sheet1, sheet2 etc to 9) and paste to sheet "Master"

andymalan

Board Regular
Joined
Feb 22, 2017
Messages
128
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
Hello all, i want to find out if there is a better way to copy from sheets1 through 9 and paste to sheet "master" one sheet below the other. here is the code i have cobbled together which does work but maybe there is a more efficient way?
Code:
' select the range to copy and paste to "master"
    Sheets("Sheet9").Select
    Rows("3:68").Select
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Sheets("Sheet8").Select
    Rows("3:68").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Sheets("Sheet7").Select
    Rows("3:68").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Sheets("Sheet6").Select
    Rows("3:68").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Sheets("Sheet5").Select
    Rows("3:68").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Sheets("Sheet4").Select
    Rows("3:68").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Sheets("Sheet3").Select
    Rows("3:68").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    ActiveWindow.SmallScroll Down:=-9
    Sheets("Sheet2").Select
    Rows("3:68").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Sheets("Sheet1").Select
    Rows("15:70").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Master").Select
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Columns("A:F").Select
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False


    ActiveWorkbook.Worksheets("Master").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Master").Sort.SortFields.Add2 Key:=Range( _
        "A2:A3734"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Master").Sort
        .SetRange Range("A1:L3734")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With

Your help will be appreciated, and I will have learned something?
best regards, Andy
 
Last edited by a moderator:
Thank you Footoo, your code does work, but it is taking longer to execute than the code I already have.
I do appreciate you wanting to help.
Very strange. It should be slightly quicker.
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Top and tail your code ike this

Code:
Optimise True

your code goes here

Optimise False

and put in same module

Code:
Private Sub Optimise(TrueFalse As Boolean)
    With Application
        .ScreenUpdating = Not TrueFalse
        .EnableEvents = Not TrueFalse
        .Calculation = xlCalculationAutomatic
        If TrueFalse Then .Calculation = xlCalculationManual
        MsgBox .ScreenUpdating & .EnableEvents & .Calculation
    End With
End Sub
 
Last edited:
Upvote 0
remove this line (i was using it when I was testing) :eeek:

Code:
MsgBox .ScreenUpdating & .EnableEvents & .Calculation
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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