Excel VBA basics: Data types, DIM & SET (Learn to use them correctly)

1 year ago
6

May 17, 2018 Excel VBA & Macros Tutorials

‍Get access to the full course here: https://www.xelplus.com/course/excel-vba-excel-macros/

It’s best practice to declare your Excel VBA variables before you use them. Declaring variables means that you give VBA a heads up that it needs to free up some memory space for your variables which will in most cases be less than the default. That's why it's important to understand the concept of data types and how much memory space each of these types will take. The less memory you allocate to a variable, the faster your code will run. I show the range associated to each data type - such as numbers, text, date, currency etc in the video.

By default VBA assigns the data type “variant” to each variable. Variant means it changes depending on the data type so is it text, number or date. It will allocate around 16 bytes of memory if it’s a number and 22 bytes + length of string.

★ Links to related videos: ★
Learn about Visual Basic Editor: https://youtu.be/NpvvwrdDcQk
Properties & methods in VBA: https://youtu.be/uYHrzo2gzbo

Blog Post: https://www.xelplus.com/excel-vba-data-types-dim-set/

★ My Online Excel Courses ★

Courses ► https://courses.xelplus.com/

✉ Subscribe & get my TOP 10 Excel formulas e-book for free
https://www.xelplus.com/free-ebook/

EXCEL RESOURCES I Recommend: https://www.xelplus.com/resources/

Get Office 365: https://microsoft.msafflnk.net/15OEg
Microsoft Surface: https://microsoft.msafflnk.net/c/1327040/451518/7593

GEAR
Camera: https://amzn.to/2FLiFho
Screen recorder: http://techsmith.pxf.io/c/1252781/347799/5161
Microphone: https://amzn.to/2DVKstA
Lights: http://amzn.to/2eJKg1U

Note: This description contains affiliate links, which means at no additional cost to you, we will receive a small commission if you make a purchase using the links. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!

#MsExcel #ExcelVBA #LeilaGharani

Loading comments...