Macro Taking Long To Fully Execute

David04Ruiz

New Member
Joined
Aug 29, 2022
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Hi all, I'm super new to macros and VBA. I run this macro on a daily basis and it always seems to get stuck when it reaches a specific line of code. It takes about a minute a or so to do a simple function which is just pulling down formulas. I will attach screenshots of what I'm trying to have it do and the lines of the code that are causing the slow down. I am just trying to drag the formula in columns A-C & E-T down to the last row based on the last row of column D (in this case row 583). The code highlighted in blue is what I think is achieving this but for some reason it takes a really long time to do this. Does anyone happen to know why or how I can speed this up? Any help is greatly appreciated!

Screenshot 2022-10-10 150937.png



Screenshot 2022-10-10 151119.png
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
It in addition to disabling screen updating when that part of the code is running, try temporaily disabling calculations too, i.e.
put this before that section of code:
VBA Code:
Application.Calculation = xlCalculationManual
and this line of code after it:
VBA Code:
Application.Calculation = xlCalculationAutomatic

Also, if you have any event procedure vode (automated VBA code) running, you should disable that too, i.e.
VBA Code:
Application.EnableEvents = False
before and this:
VBA Code:
Application.EnableEvents = True
after.

Also note: When posting VBA code, please do not post screen prints, as we cannot do much with that. Copy and paste your code and use the Code tags to format it nicely like I did.
There are instructions on how to do that here: How to Post Your VBA Code
 
Upvote 0
It in addition to disabling screen updating when that part of the code is running, try temporaily disabling calculations too, i.e.
put this before that section of code:
VBA Code:
Application.Calculation = xlCalculationManual
and this line of code after it:
VBA Code:
Application.Calculation = xlCalculationAutomatic

Also, if you have any event procedure vode (automated VBA code) running, you should disable that too, i.e.
VBA Code:
Application.EnableEvents = False
before and this:
VBA Code:
Application.EnableEvents = True
after.

Also note: When posting VBA code, please do not post screen prints, as we cannot do much with that. Copy and paste your code and use the Code tags to format it nicely like I did.
There are instructions on how to do that here: How to Post Your VBA Code
My apologies for the screenshots! So I tried adding those lines before and after but unfortunately they didn't really save any time with dragging down those formulas. It might be that this file is saved on a shared drive which is why it takes long I'm just confused as to why those specific lines of code are the culprit. The rest of the macro runs in about 2 seconds but those highlighted lines take about a minute to run.

Its not a huge deal just something I thought Id try asking about. Thank you anyways for your help, I really appreciate it!
 
Upvote 0

Forum statistics

Threads
1,215,232
Messages
6,123,765
Members
449,121
Latest member
Vamshi 8143

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