Is Your Excel VBA Running SLOW? Here are 6 Tips to Improve Your Excel VBA Performance

A prospect asked me once if I can improve his VBA code performance. After 30 minutes analysis of his code, I committed to improve performance in 95% * How can your Excel VBA code run faster, much faster?

Last week I offered some advice on improving the performance of your Excel Workbook. This week, we’ll improve your VBA code!

A story of frustration with slow VBA

Most of the VBA code out there is a result of advanced Excel users who learned some VBA statements. They know how to reference Worksheet cells, how to run a loop and maybe manage multiple Workbooks and Worksheets.

They...

Continue Reading...

Excel is slow? Here are possible causes and ways to make Excel run faster

You’ve spent days in perfecting your Excel model. Sophisticated formulas spanning multiple Workbooks are generating the results you need. But it is now heavy with long delays and response times. What could be the reason and what can you do about it?

The magic of live formulas has its toll

No doubt one of Excel’s magic is the “live grid” in which formulas connect cells, charts and formatting for real-time calculations and rendering. It Is so appealing, that we tend to forget that maintaining the web of connected cells requires resources. Compute and memory resources.

...
Continue Reading...

Scheduling Automatic Excel VBA Programs for Uninterrupted Execution

Ever needed to run an Excel Macro every day automatically? I mean, without leaving Excel open or interacting with Excel at all. Here’s how you do this taking advantage of two technologies that comes with Windows

Why schedule a daily silent job?

In one of my customer’s project that manages trainings and certifications, employees receive email and SMS notifications on various events: upcoming training reminders, training result (with a certificate attached), change of instructor, training assessment reminders etc.

The technique for doing that is using a queue. All notifications...

Continue Reading...

Using Pre-Compiler Directives for Cross-Platform Compatibility of Your Excel VBA Programs

Need your single Excel program to run on Windows and Mac? With Office 32-bit and Office 64-bit? You can do that using pre-compiler directives * Here’s what you need to know (and code!)

In my Blog post from last week In which I elaborated on writing VBA code that runs on both Office 32-bit and Office 64-bit, we ended up with a challenge. We need to include the PtrSafe and LongPtr qualifiers in external libraries declarations for Office 64-bit, but ignore these qualifiers in Office 32-bit environments (where they are unknown).

Today I’ll explain all about VBA’s pre-compiler...

Continue Reading...

Writing Excel VBA Code That Runs on Office 32-bit and 64-bit

Your Excel 2016 program runs perfect on your Excel 2016 32-bit, but fails on Excel 2007, or on Excel 2013 64-bit. Why that happens and how to write a fully compatible VBA program? Here are the answers (and some VBA code)

In last week’s Blog post, I explained and demonstrated how Windows functions libraries, or DLLs, can be called from VBA.

Leveraging external functions to Excel is great, especially considering the vast variety of functions the Windows operating system offers. However, breaking the tight Excel environment is also subject to some compatibility issues.

Why are there...

Continue Reading...

Calling External Windows Functions (DLL) From Excel VBA

Windows offers tons of readily available functions that perform almost any task we need. Why not make use of it in our Excel VBA programs? * Here’s what you need to know about calling DLLs in Excel VBA

Modular Programming

As you recall from our computer programming lessons, one of the key concepts in good software design is modularity: breaking our code into functional subroutines or functions, each responsible for a specific task with a clear interface for calling it.

Once encapsulated in a self-contained function, this functionality can be re-used in many locations in your program....

Continue Reading...

How to Create Your Own Web Service with Google Apps Script and Call it from Excel VBA

Ever needed to perform some Web task in service of your Excel VBA application? You can write your own web-service to do whatever you need * Popular use cases: access Google Sheets, Docs, Presentations, email and calendar from your Excel application!

Calling Web-services from Excel VBA

As I thoroughly explain and demonstrate in my online course: Beyond Excel Boundaries with VBA: Office, Files and Internet, you can send any HTTP request over an Internet connection from VBA using the WinHttp service library. Here’s a code snippet to send a request to some URL:

    Dim...

Continue Reading...

Excel VBA: How to Check if Printer is Ready

Your VBA program needs to send out an original document to the printer. What if the printer is offline, or disconnected? Verify the printer is ready before printing or notify the user of a problem * Here’s the VBA function for that

Why check if the printer is ready?

The first situation in which I encountered the need to verify the printer is ready, was in an application I developed for small business management, in Excel.

In my home country, Israel, tax regulations dictate that the tax invoice confirming the receipt of a payment is printed exactly ONCE. This would be the ORIGINAL...

Continue Reading...

Can Excel serve as a Database?

Excel offers large Worksheets. Data can be arranged and stored flexibly, searched and acted upon. Do we have a Database here? * Let’s sort out Excel as a Database.

What is a Database?

Simply speaking, a database is any structure in which data is to be arranged along with tools to store, manipulate and retrieve the data.

Several such pre-configured “data arrangements” are available as products, each developed in its time to solve data-related challenges. Let’s mention a couple.

Relational Database: In a relational database data is arranged in tables with relations...

Continue Reading...

Excel VBA: Restoring the State of the Application Before Returning Control to the User

When your VBA code finished its task and control is returned to the user – be sure to restore protection, hide Worksheets, enable events, reset the mouse cursor and turn on screen updating * here’s a Sub that will take care of that

A controlled environment for the user

The flexibility, diversity and power of Excel makes it a generic tool for almost any task. However, this richness of options and openness can put your data and business at risk.

Consider a large table you maintain in Excel. Mistakenly, you mis-typed a date to be: 05/10/20020. You didn’t notice. That row is...

Continue Reading...
Close

50% Complete

Two Step

Once you submit your details, you'll receive an email with a confirmation link. That's it! you're subscribed!