Forum Discussion
cheickhamala
Mar 30, 2022Copper Contributor
Problem with ActiveSheet.Paste function
Hello All, I used for a long time a small code into a worksheet to avoid doing manual Copy/Paste. Since 2019 this code worked well until yesterday. This is te part of my code where the problem happ...
HansVogelaar
Mar 30, 2022MVP
I don't know why it takes so long, but see if this works better:
If ind > 5 Then 'Pour Ă©viter de copier l'entĂȘte du tableau
Range("A" & ind - 1 & ":M" & ind - 1).Copy Destination:=Range("A" & ind)
End If- cheickhamalaMar 30, 2022Copper Contributor
Your code is very simple! Thank you for that.
I tested it but the result is similar. So, maybe the problem isn't ActiveSheet.Paste function.
- HansVogelaarMar 30, 2022MVP
Try adding the following lines at the beginning of your macro:
Application.Cursor = xlWait Application.ScreenUpdating = False Application.Calculation = xlCalculationManual Application.EnableEvents = Falseand at the end:
Application.EnableEvents = True Application.Calculation = xlCalculationAutomatic Application.ScreenUpdating = True Application.Cursor = xlDefault- cheickhamalaMar 30, 2022Copper ContributorI replaced ":=" by "=" for this line Application.Calculation:=xlCalculationManual because of an error.
The cursor change at this previous line but when the copy and paste line is executed it continues to take longer