Best CPU for Excel VBA (hardward question)

kalong08

New Member
Joined
Feb 23, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
I have a tedious VBA programme that requires several minutes to run on my two current computers. I have already tried hard to improve the code according to the guidelines found from other websites. Hardware upgrade may be the only improvement for my situation.

The capabilities of my current computers are shown below:

Computer 1:

8192MB RAM

Intel(R) Core(TM) i7-8550U CPU @1.8GHz (8 CPUs), ~2.0GHz

Computer 2:

RYZEN™ 9 4900H CPU

16GB RAM

I would like to purchase a new computer with a suitable CPU. I have checked that VBA cannot run on multi-thread and it can only use 1 processor at one time. Therefore, I am wondering the best CPU for VBA shall be determined by their Single Thread Performances. Here is a list of CPUs ranked by their Single Thread Performances. PassMark CPU Benchmarks - Single Thread Performance

Intel Core i9-11900K @ 3.50GHz is ranked first. However, I have found out that it has 8 Cores and 16 Threads. I am wondering if VBA can really utilize all its cores. I am not sure if it is really the best CPU for VBA.

VBA uses 1 processor only at a time. Does it mean I shall find a CPU with the least number of Cores but with highest clock speed? May I further I ask which CPU is the most suitable for running a VBA?

Greatly appreciate for your kind attention.

Thanks!
 

Some videos you may like

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows
What have you done to try and improve the code?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows
Some of the tips there are quite useful, some I'm not too sure about - for example, I'm not sure how combining multiple lines on one line separated by a colon would speed things up.

I don't think not using Option Explicit would make a lot of difference efficiency wise but I would highly recommend using it to avoid other problems - it could actually help speed up writing the code.

There is one major thing not mentioned on that page, avoid+ writing/reading directly to/from sheets if possible.

Whether that would be relevant in your situation is hard to tell without knowing more about what you are trying to do with the code.

P.S. Another simple thing to aid with efficiency, don't use Integer use Long (integer).
 

diddi

Well-known Member
Joined
May 20, 2004
Messages
2,910
Office Version
  1. 2010
Platform
  1. Windows

ADVERTISEMENT

i find optimal speed by not using sheets at all. i run purely on userforms with all storage in text files and all calculations from RAM. that said, i trialled a basic compiler that compiled code very much like VBA into addins for excel. on a prime number benchmarch it was like 100 times quicker running inside excel than the equivalent VBA!

you could post some code for others to look at if you please
 

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
13,872
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
There is one major thing not mentioned on that page, avoid+ writing/reading directly to/from sheets if possible.
I must agree with Norie, interacting with the sheet multiple times is one of the main reasons code runs slowly which is one of the reasons you see codes posted using Arrays, Scripting Dictionary etc. so they only interact once with the worksheet.

As for the article I also haven't noticed or seen anyone claim that writing on a single line with separators makes the code noticeably faster (it can make it harder to read though) and as for
1614103101861.png

It is faster to avoid the PasteSpecial totally with

VBA Code:
Sheets("Source").Range("A1:E10").Copy Sheets("Destination").Range("A1")

Which you also don't need the Application.CutCopyMode = False line for.
 
Last edited:

diddi

Well-known Member
Joined
May 20, 2004
Messages
2,910
Office Version
  1. 2010
Platform
  1. Windows
also using With blocks speeds things up because excel is not having to re-reference sources
 

Watch MrExcel Video

Forum statistics

Threads
1,122,961
Messages
5,599,061
Members
414,281
Latest member
Engjamal2021

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
Top