Using the Asc Function to Return a Character Code : Data Type Convert « Data Type Functions « VBA / Excel / Access / Word






Using the Asc Function to Return a Character Code

 
'Use the Asc function to return the character code for the first character of the current selection

'Using the Val Function to Extract a Number from the Start of a String
Sub valDemo()
    Dim Address1 As String
    Address1 = "asdf 123"
    Dim StreetNumber As Integer
    StreetNumber = Val(Address1)
    
    Debug.Print StreetNumber
End Sub

 








Related examples in the same category

1.VBA's Functions for Simple Data Conversion
2.Use CInt to convert input value to integer
3.VBA's Functions for Complex Data Conversion
4.Using the Str Function to Convert a Value to a String