Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Variant Declaration Question? (VBA for Excel)

    Dim myTest
    Dim myTest as Variant

    Is there a difference between the two declarations above? Is Dim myTest the same as Dim myTest as Variant?
    Regards,
    Rudi

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Variant Declaration Question? (VBA for Excel)

    The declarations are the same. From the online help:
    <hr>If you don't specify a data type or object type, and there is no Deftype statement in the module, the variable is Variant by default.<hr>
    I try to use a specific type wherever possible, and only use Variants if it is really necessary. To make this clear, I tend to use Dim ... As Variant in such cases, but it wouldn't make a difference if I just used Dim ....

  3. #3
    Gold Lounger
    Join Date
    Feb 2004
    Location
    Cape Town, RSA
    Posts
    3,444
    Thanks
    0
    Thanked 1 Time in 1 Post

    Thanx!

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Regards,
    Rudi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •