Very slow code....

espenskeie

Well-known Member
Joined
Mar 30, 2009
Messages
636
Office Version
  1. 2016
Platform
  1. Windows
Hello

Is there anyone who could tell my why this code is very slow? I copy columns from one book to another:

Code:
Sub KopierProdukter()

    Windows("Produktliste.xlsm").Activate
    Sheets("Produktliste").Select
    Range("C:C, L:L, U:U, AD:AD, AM:AM, AV:AV, BE:BE, BN:BN").Select
    Selection.Copy
    
    Windows("Prisliste.xlsm").Activate
    Sheets("Sheet2").Select
    Range("C1").Select
    ActiveSheet.Paste
        
    Workbooks("Prisliste.xlsm").Activate
    ActiveWorkbook.Save
    ActiveWorkbook.Close
    
End Sub

Regards
Espen
 
Hello Norie

I have tried to open the book that I thought was small. It took 28 seconds.

BUT I did check the filesize, and its huge, 16,8 MB. I think there is something stored into this book that shouldn't be there. The other books I have been working with userforms and pictures. Maybe I have filled this book with those pictures?

Regards
Espen
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Espen

What pictures?

I can't recall you mentioning anything like that.:)
 
Upvote 0
I have three books, one is privat (Produktliste), one shared (Prisliste), and one for my customer (with lots of pictures attached to the userforms imagebox.)

The Pricelist-book should be extremely smallsized, as it only have numbers in few cells. But now it is 19MB ++. I will try to delete the book and create a new one.

Then I will check if this one also grow and become an elephant too :)
 
Upvote 0
I deleted the old Prisliste, and created a new one. It is now 12kb in size!!! And superfast :)

Thank you very much for your time. I really appreciate that you spend so much time on projects and problems that I have, thats really nice of you!

Have a great day :)
 
Upvote 0

Forum statistics

Threads
1,214,952
Messages
6,122,457
Members
449,083
Latest member
Ava19

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