Slowest Macro ever - Please Help! Copy Paste

Caveman1964

Board Regular
Joined
Dec 14, 2017
Messages
127
Office Version
  1. 2016
Platform
  1. Windows
I have written this over and over again. Its takes 30 seconds. I am a novice doing this a few months.
I should be defining...tried that but could not get this to speed up. It works but looks embarrassing, I am aware.
After a couple of days of trying to speed it up, I am turning to the Guru's once again.
please review and tell me why this is so slow. I so appreciate any help or rewrite.

Sub SubmitDataNewEntry()
'unprotect
Sheets("Do Not Alter").Unprotect "1"
Sheets("Data Collection").Unprotect "1"
Sheets("Complaint Entry").Unprotect "1"


Sheets("Do not alter").Rows(7).Copy
Sheets("Data Collection").RANGE("A7").End(xlDown).Offset(1, 0).EntireRow.Insert

Sheets("complaint entry").RANGE("e5:e22").Copy
Sheets("data collection").RANGE("A7").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True


Sheets("data collection").RANGE("l7:l2500").Copy
Sheets("data for dashboard").RANGE("a77").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Sheets("Complaint entry").Activate
RANGE("e5:e22").ClearContents
RANGE("E5").Select


ActiveWorkbook.Save
'Protect
Sheets("Do Not Alter").Protect "1", True, True
Sheets("Data Collection").Protect "1", True, True
Sheets("Complaint Entry").Protect "1", True, True

End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
See if this makes a difference:
Code:
Sub SubmitDataNewEntry()
    With Application
        .ScreenUpdating = False
        .Calculation = xlCalculationManual
    End With
    Dim ws As Worksheet
    For Each ws In Sheets(Array("Do Not Alter", "Data Collection", "Complaint Entry"))
        ws.Unprotect "1"
    Next ws
    With Sheets("data collection")
        Sheets("Do not alter").Rows(7).Copy .Range("A7").End(xlDown).Offset(1, 0)
        Sheets("complaint entry").Range("e5:e22").Copy
        .Range("A7").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
        .Range("l7:l2500").Copy
        Sheets("data for dashboard").Range("a77").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
    End With
    Sheets("Complaint entry").Range("e5:e22").ClearContents
    For Each ws In Sheets(Array("Do Not Alter", "Data Collection", "Complaint Entry"))
        ws.Unprotect "1", True, True
    Next ws
    With Application
        .CutCopyMode = False
        .ScreenUpdating = True
        .Calculation = xlCalculationAutomatic
    End With
    ActiveWorkbook.Save
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,642
Members
452,663
Latest member
MEMEH

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