Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-30-2022, 10:46 AM
cheickna cheickna is offline Problem with ActiveSheet.Paste function Windows 10 Problem with ActiveSheet.Paste function Office 2021
Novice
Problem with ActiveSheet.Paste function
 
Join Date: Mar 2022
Posts: 1
cheickna is on a distinguished road
Default 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 happend.
Code:
            If ind > 5 Then 'Pour éviter de copier l'entête du tableau
                splagePrec = "A" + Trim(CStr(ind - 1)) & ":M" & Trim(CStr(ind - 1))
                Range(splagePrec).Select
                Selection.Copy
                splage = "A" + Trim(CStr(ind))
                Range(splage).Select
                ActiveSheet.Paste
            End If
Each part of this code run correctly until the instruction ActiveSheet.Paste.
It can take 15 min to execute this simple line.
I have tested on Windows 11/Excel 2019 PC and on Windows 10/Excel 2016 PC. the result is similar.


I don't understand why this problem start now
thank you for any help
Reply With Quote
  #2  
Old 03-30-2022, 02:47 PM
p45cal's Avatar
p45cal p45cal is offline Problem with ActiveSheet.Paste function Windows 10 Problem with ActiveSheet.Paste function Office 2019
Expert
 
Join Date: Apr 2014
Posts: 863
p45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant future
Default

A guess:
Either you're copying some formulae which are complex or refer to entire rows/columns
and/or the cells you're changing are the precedents to many and/or complex formulae (possibly also involving entire columns).
So the time taken may be the recalculation time. Do you see evidence of calculation taking place on the status bar at the bottom of the sheet? Changing calculation to manual may not speed things up but it's worth a try to see if it makes a difference.


ps. your code could probably be shortened to:
Code:
If ind > 5 Then    'Pour éviter de copier l'entête du tableau
  Range("A" & ind - 1 & ":M" & ind - 1).Copy Range("A" & ind)
End If
or
Code:
If ind > 5 Then    'Pour éviter de copier l'entête du tableau
  Cells(ind - 1, "A").Resize(, 13).Copy Cells(ind, "A")
End If
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with ActiveSheet.Paste function Copy and paste function for Command Button Will267 Word VBA 1 05-12-2021 02:31 PM
Problem with ActiveSheet.Paste function Replicate the copy/paste function, without involving the clipboard alex100 Word VBA 8 11-09-2020 08:19 AM
Problem with ActiveSheet.Paste function Problem with Value function misokol Excel 3 01-11-2017 08:59 AM
Problem with function PRA007 Word VBA 2 01-13-2016 01:11 AM
New mail - Paste function craigfer Outlook 0 05-27-2015 08:32 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft