By using booksticle.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

 


As String

The As is used to define a variable type.

Variables can be stored as
  • String
  • Integer
  • Variant
  • Other

    Strings

    Strings are groups of characters like a name "John".

    In VBA and Excel all strings are enclosed in the double quote character ("this is a string").

    s = "abc"

    s2 = "def"

    Strings can be concatenated together (joined) via the & operator.

    s3 = s & s2

    so s3 is "abcdef"


    For beginners you can leave off the type and the variable is declared as a Variant.

    This means the value is based on whatever you store in the variable.

    As is used typically:
  • Dim x as Integer
  • Dim x,y as String
  • Function calc(a as integer, b as integer) as Integer
  • Sub test(sRoutine as String)

    Variables can also be declared with a suffix character
    CharacterType
    $String
    &Long
    #Double
    @Currency
    %Integer

  •    
    Home | About | Videos | Websites | Jobs | FAQ | Privacy | Terms of Service | Edit | Feedback | Copyright © 2024 All Rights Reserved