PeterM3532
New Member
- Joined
- May 8, 2013
- Messages
- 1
Hello - I have a large spreadsheet with lots of pivot tables and data, and wrote a long VBA program that configures the pivot tables based on user selections which are made in a VBA form. The user selections are also stored in a worksheet within the file.
I ran the code from the VBA form, and it takes forever to run - about 20 minutes. If I go to the Macro button in the ribbon and run the code, it still takes about 20 minutes (I would expect that - it's the same code).
However, if I create a button control on my worksheet and link the same macro to this button, it runs in 4 seconds.
I optimized the heck out of this code, so I expect it to run fast, but this makes absolutely no sense that the same code would run at such different speeds depending on how I trigger it.
Has anyone ever seen anything like this before? I am running Excel 2010 on Win XP, with an i5 processor and 3GB of RAM.
I ran the code from the VBA form, and it takes forever to run - about 20 minutes. If I go to the Macro button in the ribbon and run the code, it still takes about 20 minutes (I would expect that - it's the same code).
However, if I create a button control on my worksheet and link the same macro to this button, it runs in 4 seconds.
I optimized the heck out of this code, so I expect it to run fast, but this makes absolutely no sense that the same code would run at such different speeds depending on how I trigger it.
Has anyone ever seen anything like this before? I am running Excel 2010 on Win XP, with an i5 processor and 3GB of RAM.