• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA To copy and paste

Manuel998

Member
Hi

I have got a code that copies and pastes data in different sheets but to the same range (as in the script), I was wondering if there is a code that consolidates all of this into one rather than me running macros on each sheet? (code is below)

Sub CHPP()
'
' CHPP Macro
'

'
Range("C11:N19").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=15
Range("C24").Select
ActiveWindow.SmallScroll Down:=6
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
Sub Charged_Hrs()
'
' Charged_Hrs Macro
'

'
Range("C11:N30").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=18
Range("C34").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=18
End Sub
Sub EMEIA_FTE()
'
' EMEIA_FTE Macro
'

'
Range("C12:S32").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=15
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("C36").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=21
End Sub
 
Hi,

You can use the following:
Code:
Sub Copy_Paste()

    With Sheets("...") 'Replace ... with the sheet name
        .Range("C11:N19").Copy
        .Range("C24").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    End With

    With Sheets("...") 'Replace ... with the sheet name
        .Range("C11:N30").Copy
        .Range("C34").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    End With
   
    With Sheets("...") 'Replace ... with the sheet name
        .Range("C12:S32").Copy
        .Range("C36").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
    End With
   
End Sub

Hope this helps
 
Back
Top