How to use the VBA STRCONV Function (Syntax + Example)

HomeVBA Functions LIST (Category Wise)How to use the VBA STRCONV Function (Syntax + Example)

The VBA STRCONV function is listed under the text category of VBA functions. When you use it in a VBA code, it can convert a string into a specified format. There are total of 9 different types of formats that you can convert to.

Syntax

StrConv(String, Conversion, [LocaleID])

Arguments

  • String: The string you want to convert.
  • Conversion: A VbStrConv enumerator to specify the type of conversion that is to be made.
  • [LocaleID]: The localeID to be used [This is an optional argument and if omitted VBA takes system LocaleID by default].

Example

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

Sub example_STRCONV()
Range("B1").Value = StrConv(Range("A1"), vbProperCase)    
End Sub

In the above code, we have used the STRCONV to convert the string that we have in the cell A1 into a proper case string.

Related Functions

FORMAT | INSTR | INSTRREV | LCASE | LEFT | LEN | LTRIM | MID | REPLACE | RIGHT | RTRIM | SPACE | STRCOMP | STRING | STRREVERSE | TRIM | UCASE