Excel: Data types

When you create a new file, all of the cells in the worksheet are of a general type. This means that when you enter a new value, Excel tries to guess whether you wanted to enter text, a numerical value, a date, etc.

I present which types of data you can use in VBA: 

Text

The text is the only data type in Excel that is, by default, aligned to the left. It is used mainly for naming table headers, descriptions, etc. 

Numbers 

This type of data includes integers, fractions, percentages, currency, and other types of figures. These are the most common data types in most worksheets. 

Dates and times

This type includes the date and time, stored in different formats. For example, the date with time: 2003-07-07 12:32:56 can also be saved as 2003-07-07 or July 7, 2003.

Those examples are just a few of many different date and time combinations. 

Logical values 

This data type can contain one of the two values: TRUE or FALSE. In the vast majority of cases, you won't use this data type. It is useful when you work with the macro code. This value is, by default, centered. 

TIP

If you want dates or numbers to be treated as text, you must precede the value with " ' ", eg. '2013-12-12 or '28%.