Vba Code - Copy/Paste rows from one workbook to another

ksamokovliev

New Member
Joined
May 25, 2021
Messages
9
Office Version
  1. 2019
Platform
  1. Windows
Dear All,

I'm newmember of your forum , but I use it very often to know more about vba codes.

I have read a lot of posts and comments about following issue , but I did not found solution for mine.

I want to create vba code which copy rows from one workbook to another workbook based on date criteria - one of column ( inputing - starting date /ending date)

If you help me to solve this issue I will safe a lot of time for copy and pasting information



Be healthy!
 
There are a few reasons why the code could be slow.

Firstly, loops are generally slow and inefficient, and can be slow if you have a lot of data to go through.
It is possible to try to use Advanced Filters instead, though that would be a bit more complex.

But there are also other reasons your code could be slow, such as if you have any VBA code interfering with it, especialyl Event Procedure VBA code which is code that automatically runs on some event happening.

You can try temporarily disabling events and calculations while the code runs to see if that makes it any faster.

So at the top of the code where this line exists:
VBA Code:
Application.ScreenUpdating = False
add these two lines:
VBA Code:
Application.Calculation = xlCalculationManual
Application.EnableEvents = False

and then at the bottom of your code where you have this line:
VBA Code:
Application.ScreenUpdating = True
add these two lines:
VBA Code:
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
There are a few reasons why the code could be slow.

Firstly, loops are generally slow and inefficient, and can be slow if you have a lot of data to go through.
It is possible to try to use Advanced Filters instead, though that would be a bit more complex.

But there are also other reasons your code could be slow, such as if you have any VBA code interfering with it, especialyl Event Procedure VBA code which is code that automatically runs on some event happening.

You can try temporarily disabling events and calculations while the code runs to see if that makes it any faster.

So at the top of the code where this line exists:
VBA Code:
Application.ScreenUpdating = False
add these two lines:
VBA Code:
Application.Calculation = xlCalculationManual
Application.EnableEvents = False

and then at the bottom of your code where you have this line:
VBA Code:
Application.ScreenUpdating = True
add these two lines:
VBA Code:
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
U r the best!
Thank you Joe4 , now everything works as I want.
Cheers!!!
 
Upvote 0
Excellent!
Glad to hear it!
:)

BTW, I am re-marking the original code reply as the solution, as the code worked, you just needed some other improvements. If a newcomer looked at the question and the last reply that was marked as the solution, it doesn't make much sense without the original code that worked.
 
Upvote 0
Excellent!
Glad to hear it!
:)

BTW, I am re-marking the original code reply as the solution, as the code worked, you just needed some other improvements. If a newcomer looked at the question and the last reply that was marked as the solution, it doesn't make much sense without the original code that worked.
Great! You are right.
My mistake.
I'm so glad that this forum offer me so professional helping with finding/creating solution. You and Mr Excel team are very helpful!
Be healthy !
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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