+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    11-14-2007
    Posts
    91

    What do [brackets] mean in VBA?

    Hi all

    I get the impression that the use of brackets [such as this] in VBA code is shorthand to produce the same compiled effect as an alternative more verbose (but possibly to me easier to understand) coding.
    Example
    Code:
    Private Sub UserForm_Initialize()
        Me.ComboBox1.List = [MyArray]
    End Sub
    Could someone please re-write the above code without using the bracketed syntax, just so that I can understand the effect of that syntax?

    Thanks
    Last edited by 1eyedjack; 02-22-2010 at 04:53 PM.

  2. #2
    Forum Moderator shg's Avatar
    Join Date
    06-21-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007
    Posts
    25,134

    Re: What do [brackets] mean in VBA?

    The brackets are a shortcut to the VBA Evaluate function. They look nice and compact, but when Evaluate is not needed, just add a function where none is necessary.

    Code:
    Me.ComboBox1.List = Range("MyArray").Value
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    11-14-2007
    Posts
    91

    Re: What do [brackets] mean in VBA?

    Thanks - just what I needed to know

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0