hi,
i am using this code to copy data and paste another sheet
but its working very slowly, please any idea to make this faster code
![]()
Please Login or Register to view this content.
hi,
i am using this code to copy data and paste another sheet
but its working very slowly, please any idea to make this faster code
![]()
Please Login or Register to view this content.
Use Code-Tags for showing your code :
Please mark your question Solved if there has been offered a solution that works fine for you
If You like solutions provided by anyone, feel free to add reputation using STAR *
setting the screenupdating to false at the beginning and then reversing it at the end
in the beginning of the code
you may also set the calculation to manuall at the beginning and the to automatic in similar fassion if your sheet is full of formulas that are calculated after every operation.![]()
Please Login or Register to view this content.
at the end of the code before end sub key word
![]()
Please Login or Register to view this content.
Teach me Excel VBA
One of the reasons your code is running slowly is that you are copying and pasting several columns separately and repeating the same process many times
Copy/Paste copies only filtered rows - so I have not included specialcells in the code
Instead of copying and pasting in bits
- firstly copy and paste the whole of the data values range to a temporary sheet
- then instead of copying and pasting each column, attribute the values instead
I am guessing that you have filter headers in row 7 and that you are copying all your filtered data range - if not
replace this in the code below
with![]()
Please Login or Register to view this content.
and the Resize becomes Resize(lr) instead of Resize(lr - 1)![]()
Please Login or Register to view this content.
Create a temporary sheet and name it "Temp" and try replacing everything in your code below line On Error Resume Next (which you should no longer require)
![]()
Please Login or Register to view this content.
And do not forget to include ImranBhatti's suggestions - which avoid the sheet being recalculated and the display refreshed every time a value is changed by VBA
Last edited by kev_; 04-25-2017 at 03:46 AM.
Click *Add Reputation to thank those who helped you. Ask if anything is not clear
This will not make much difference to speed but by adding a variable, the code can be simplified on the 7 rows where the values are being attributed
create variable to find the next row
then![]()
Please Login or Register to view this content.
is simplified to![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Last edited by kev_; 04-25-2017 at 03:35 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks