List of Documents
To break a line of VBA code, end the line with a space and an underscore. This article covers the line continuation character, examples for arguments and If statements, and caveats such as the line limit and comments.
When processing text in VBA, understanding line break codes is essential. This article explains the differences between CR, LF, and CRLF line break codes and their behavior in VBA.
In programming, it is generally recommended to avoid the use of magic numbers. While in languages other than VBA, you may rarely encounter magic numbers with a little bit of learning, in VBA, it is often difficult to avoid them due to the nature of the data being handled. If you code without thinking, magic numbers will naturally emerge. In this article, I would like to introduce the approach I frequently use to handle this issue, along with some code examples.
Learn how to set print margins (top, bottom, left, right, header, footer) using Excel VBA. This article explains how to use PageSetup object properties to change margins in bulk, apply to multiple sheets, and practical use cases.
Explains the difference between Property Get, Property Let and Property Set in VBA: use Let for value-type properties and Set for object-reference properties, with class module code examples.
Learn the differences between Range and Cells for cell references in Excel VBA. This guide explains when to use each, with practical examples for beginners to intermediate users to write efficient VBA code.
Learn how to use regular expressions in VBA. This guide covers RegExp object properties (Pattern, Global, IgnoreCase) and methods (Test, Execute, Replace) with practical examples.
Master the essential VBA string manipulation functions. Learn how to use Split, Join, InStr, Mid, Left, Right, Replace, Trim, and more for efficient text processing.
In general, it is common to perform error handling in each function and then throw to the calling code. However, implementing this in VBA is not straightforward. If you create an error handler, it will suppress the error and if you try to raise the error again from there, it will result in an infinite loop within that function. A specific example is when you want to open a file using the Open function and still raise an error if it fails, while also propagating the error to the calling code.
Learn three common methods to pause execution in VBA: Sleep, Application.Wait, and DoEvents. This guide explains the usage, features, and trade-offs of each approach.