Ad space (banner)
Lesson 11 / 20

Working with strings

This lesson covers basic string handling in VBA.

Built-in functions are provided such as Len (character count), UCase (upper case), and Left (a substring from the left).

The sample code checks the character count with Len(message) and takes the first five characters with Left(message, 5).

A common early stumble is that these are standalone functions rather than method calls. You cannot write message.Len() — it is Len(message).

In professional work, string handling — tidying and validating the data entered into cells — is essential in practically every macro.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run VBA directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)