Learn Excel - Simplify Life with Excel Concepts

Excel ASC Function (VBA)

ASC Function VBA Code

How to use the ASC Function (VBA)

This Excel tutorial explains how to use the Excel ASC function with syntax and examples using VBA.

SUMMARY:

The Excel VBA ASC function changes full-width (double-byte) character string to half-width (single-byte) characters.

For example,

  • The VBA Code Asc("RA") would return 82
  • The VBA Code Asc("ra") would return 114

PURPOSE:

To converts a full-width (double-byte) characters to half-width (single-byte) characters.

RETURN VALUE:

The Asc function returns a Integer value.

SYNTAX:

ASC(text)

ARGUMENTS:

The ASC function syntax has the following arguments:

  • text: Required. The string character to retrieve the ASCII value for.
    • If the text string is more than one character, then function will return the ASCII value for the first character only and ignore all of the characters after the first character.

REMARKS:

  • The Asc function can only be used in VBA code in Microsoft Excel.
  • If text arguments does not contain any full-width letters, then the text is not changed.
  • The Asc function only change the first character and ignore all of the characters after the first.

Useful Links: Link 1Link 2Link 3Link 4