Home ➜ VBA Functions LIST (Category Wise) ➜ **How to use the VBA OCT Function (Syntax + Example)**

The VBA OCT function is listed under the data type conversion category of VBA functions. When you use it in a VBA code, **it can convert a number into octal notation () and return the value as a string**. You can learn more about the octal numeral system from here.

## Syntax

**Oct(Number)**

## Arguments

**Number**: An integer for which you want to convert to octal.

## Example

To practically understand how to use VBA OCT function, you need to go through the below example where we have written a vba code by using it:

```
Sub example_OCT()
Range("A1").Value = Oct(989)
Range("A2").Value = Oct("&H3E6")
End Sub
```

In the above example, we have used the OCT to convert decimals to octal and hexadecimal to octal.

## Notes

- If the value specified is a value other than a number or a number that can’t be recognized as a number, VBA will return the run-time 13 error.
- If the supplied number is not a whole number then it will be rounded to the nearest whole number.

## Related Functions

CBOOL | CBYTE | CCUR | CDATE | CDBL | CDEC | CHR | CINT | CLNG | CSNG | CSTR | CVAR | FORMATCURRENCY | FORMATDATETIME | FORMATNUMBER | FORMATPERCENT | HEX | STR | VAL