Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/VBA-tools2/XLSpeedUp.vba
Excel VBA class that bundles stuff to "speed up" VBA code execution.
https://github.com/VBA-tools2/XLSpeedUp.vba
excel-vba
Last synced: about 2 months ago
JSON representation
Excel VBA class that bundles stuff to "speed up" VBA code execution.
- Host: GitHub
- URL: https://github.com/VBA-tools2/XLSpeedUp.vba
- Owner: VBA-tools2
- License: mit
- Created: 2022-11-07T16:21:54.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-17T23:54:42.000Z (11 months ago)
- Last Synced: 2024-08-13T07:18:19.258Z (5 months ago)
- Topics: excel-vba
- Language: VBA
- Homepage:
- Size: 37.1 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: docs/README.adoc
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - VBA-tools2/XLSpeedUp.vba - Excel VBA class that bundles stuff to "speed up" VBA code execution. (VBA)
README
= XLSpeedUp.vba
:experimental:
:icons: // not sure if this is needed
:demodir: ../demo
:sourcedir: ../src
:testdir: ../tests
:uri-commit-messages: https://www.conventionalcommits.org
:uri-CheJunkie-SpeedUpExcel: https://chejunkie.com/knowledge-base/speed-up-class-excel-vba/
:uri-GitHub-FirstContribution: https://github.com/firstcontributions/first-contributions
:uri-license: https://choosealicense.com/licenses/mit/
:uri-rubberduck: https://rubberduckvba.com/
:uri-UnitTests: https://en.wikipedia.org/wiki/Unit_testing
// show the corresponding icons on GitHub, because otherwise "just" the text will be shown
ifdef::env-github[]
:caution-caption: :fire:
:important-caption: :exclamation:
:note-caption: :information_source:
:tip-caption: :bulb:
:warning-caption: :warning:
endif::[]Excel VBA class that bundles stuff to "speed up" VBA code execution.
This is essentially a republish of Brian Satola's class which can be found at {uri-CheJunkie-SpeedUpExcel}.
So all credits go to him!The main reason for this repository is to increase its visibility.
== Features
Bundle some common tricks to speed up VBA code execution.
These mainly are* turn off worksheet calculation
* turn off screen updating
* ignore events== Prerequisites / Dependencies
Since this is an Excel VBA class you obviously need Microsoft Excel.
[#how-to-install]
== How to install / Getting startedAdd the file(s) from the link:{sourcedir}[src] folder to your project.
Yes, it's that simple.._If you need some more advice on how to do that, expand me._
[%collapsible]
====
. Open Microsoft Excel.
. Open the Visual Basic Editor (VBE) (kbd:[Alt+F11]).
. Add the file(s) in the link:{sourcedir}[src] folder to your VBA project.
** With {uri-rubberduck}[Rubberduck]:
.. Right-click on the project to which you want to add the file(s) in the "`Code Explorer`" (to show it press kbd:[Ctrl+R]) and click on menu:Add[Existing Files...].
.. Select all files in the link:{sourcedir}[src] folder and click on btn:[Open].
** Without Rubberduck:
.. Select all files in the link:{sourcedir}[src] folder in Windows File Explorer.
.. Drag-and-drop them to the corresponding project in VBE's "`Project Explorer`". +
(To show it press kbd:[Ctrl+R].
Hit it twice if the Code Explorer shows up first.)
// BUG: "project name" can't be put in normal angle brackets, because the closing bracket would be interpreted as menu delimiter. I couldn't find a way how to "escape" that (i.e. a backslash didn't work). Thus, single guillemets are used.
. Check, if there are obvious errors by compiling the project (menu:Debug[Compile ‹project name›]).
. Save the file/project.
.. Be sure that the file/project you want to save is "`active`" in the VBE by checking, if its name is shown in VBE's title bar. +
(If it's not, open a (class) module of the corresponding project (and close it again).)
.. Press the "`Save`" button (the disc symbol similar to 💾) in VBE's toolbar.
.. Check that the file (really) was saved by having a look at the "`last modified date`" of the (project) file in the Windows File Explorer.
====== Usage / Show it in action
A most basic example is
[source,vba]
----
Public Sub DoSomething()
Dim SpeedUp As XLSpeedUp
Set SpeedUp = New XLSpeedUp
SpeedUp.TurnOn'do something
SpeedUp.TurnOff
End Sub
----You can also have a look in the link:{demodir}[demo] folder for a full (dummy) example.
== Running Tests
Yes, {uri-UnitTests}[Unit Tests] in Excel _are_ possible.
For that you need to have the awesome {uri-rubberduck}[Rubberduck] AddIn installed (and enabled).The procedure is very similar to the one given in the <> section, but this time add the files from the link:{testdir}[tests] folder (instead of the files from the link:{sourcedir}[src] folder).
When you are done with that, additionally perform the following steps.. Check that the files from the link:{sourcedir}[src] folder are present in the project as well or that you have a reference to project with the source files.footnote:[
See the collapsible in the next point on how to do that.
If you use the Rubberduck way, before adding the reference you first need to switch to the menu:Projects[] tab.
] +
(Otherwise tests will/should fail.)
. Add a reference to the "`Rubberduck AddIn`" to the project (with the test modules).
+
._If you don't have a clue how to do that, expand me._
[%collapsible]
====
* With {uri-rubberduck}[Rubberduck]:
. Right-click somewhere on the project in the "`Code Explorer`" and click on menu:Add/Remove{sp}References...[].
. Add the reference.
.. Type (parts of) the library name in the search box until you see it in below (left) list or it is empty.
** If the AddIn file name is in the lower left list box:
... Select the library in the (left) list and
... click on the btn:[➨] button to add it to the project references. +
** If the the AddIn file name is _not_ in the list:
... Click on the btn:[Browse...] button.
... Browse to the folder where the AddIn is located.
... Select the AddIn and
... press the btn:[Open] button.
. Click on the btn:[OK] button to close the window.
* Without Rubberduck:
. Open the Reference manager in the VBE (menu:Tools[References...]).
** If the AddIn project name is in the list of available references:
.. Add a checkmark to the corresponding library.
** If it's _not_ in the list:
.. Click on the btn:[Browse...] button.
.. Browse to the folder where the AddIn is located.
.. Select the AddIn and
.. press the btn:[Open] button.
. Click on the btn:[OK] button to close the window.
. Save the file/project.
====
+
. Open the "`Test Explorer`" (menu:Rubberduck[Unit Tests > Test Explorer]).
. Run the tests by clicking menu:Run[All Tests].== Used By
This project is used by (at least) these projects:
* https://github.com/VBA-tools2/SeriesEntriesInCharts.vba[]
If you know more, we will be happy to add them here.
In addition it is used by a lot of private, i.e. non-public, Excel AddIns created by the authors.== Known issues and limitations
None that we are aware of.
[#contributing]
== ContributingAll contributions are highly welcome!!
If you are new to git/GitHub, please have a look at {uri-GitHub-FirstContribution} where you will find a lot of useful information for beginners.
We recently were pointed to {uri-commit-messages} which sounds very promising.
We will use them from now on too (and hopefully don't forget it in a hurry).== Further Reading
Here is a collection of (useful) links that deal with writing efficient/performant code:
* Microsoft Docs: https://docs.microsoft.com/en-us/office/vba/excel/concepts/excel-performance/excel-improving-calculation-performance[Excel performance: Improving calculation performance]
* Charles Williams Blog: https://fastexcel.wordpress.com/making-your-vba-udfs-efficient/[Making your VBA UDFs Efficient]If you know other great sources for this topic, please let us know and we'll be happy to extend the list.
== FAQ
[qanda]
What are the `+'@...+` comments good for in the code?::
You should really have a look at the awesome {uri-rubberduck}[Rubberduck] project!== Similar Projects
None that we are aware of.
But if _you_ know some, please let me know.
Maybe we can combine forces.== License
{uri-license}[MIT]