VBA에서 형변환 관련 함수 모음
Syntax
CBool(expression)
CByte(expression)
CCur(expression)
CDate(expression)
CDbl(expression)
CDec(expression)
CInt(expression)
CLng(expression)
CLngLng(expression) (Valid on 64-bit platforms only.)
CLngPtr(expression)
CSng(expression)
CStr(expression)
CVar(expression)
The required expression argument is any string expression or numeric expression.
Return Types
The function name determines the return type as shown in the following:
Function |
Return Type |
Range for expression argument |
CBool |
Any valid string or numeric expression. | |
CByte |
0 to 255. | |
CCur |
-922,337,203,685,477.5808 to 922,337,203,685,477.5807. | |
CDate |
Any valid date expression. | |
CDbl |
-1.79769313486231E308 to -4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E308 for positive values. | |
CDec |
+/-79,228,162,514,264,337,593,543,950,335 for zero-scaled numbers, that is, numbers with no decimal places. For numbers with 28 decimal places, the range is +/-7.9228162514264337593543950335. The smallest possible non-zero number is 0.0000000000000000000000000001. | |
CInt |
-32,768 to 32,767; fractions are rounded. | |
CLng |
-2,147,483,648 to 2,147,483,647; fractions are rounded. | |
CLngLng |
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807; fractions are rounded. (Valid on 64-bit platforms only.) | |
CLngPtr |
-2,147,483,648 to 2,147,483,647 on 32-bit systems, -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 on 64-bit systems; fractions are rounded for 32-bit and 64-bit systems. | |
CSng |
-3.402823E38 to -1.401298E-45 for negative values; 1.401298E-45 to 3.402823E38 for positive values. | |
CStr |
Returns for CStr depend on the expression argument. | |
CVar |
Same range as Double for numerics. Same range as String for non-numerics. |
'공부 > VBA' 카테고리의 다른 글
VBA - Me keyword (0) | 2011.04.18 |
---|---|
VBA - The On Error Statement (0) | 2011.04.18 |
엑셀 함수 - 지난 기간 구하기: NETWORKDAYS, TODAY (0) | 2011.04.14 |