+ Reply to Thread
Results 1 to 5 of 5

describing VBA commands/code

  1. #1
    Registered User
    Join Date
    02-25-2008
    Posts
    2

    describing VBA commands/code

    Hi everyone,

    I need help explaining the purpose of each of the following commands and a short description if possible. They are numbered 1-6.

    Please Login or Register  to view this content.
    I'd really appreciate any help given, I'm kind of new to the whole programming thing.

    Thanks in advance!

    Cheers,

    Zealot

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    What descriptions do you have for them?
    If you let us know what you think they do, we could point out any errors.

    Hint:the location of 1) 2) and 6) is important.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    02-25-2008
    Posts
    2
    Thanks Mike, here are what I think each does.

    1. Option explicit prevents you from using a variable without declaring it. It makes VBA alert the user if an undeclared variable is used by inserting the Option Explicit statement as the first line in the module.

    2. The line declares the variable "Temp", a variable which stores the value to be returned before actually assigning it to the functions name, as a double data type, which stores precision floating point numbers from –1.79769313486232E308 to –4.94065645841247E-324.

    3. By setting ScreenUpdating to False at the Start of the macro, it is used to stop the constant screen flickering associated with recorded macro and is also used to speed up the execution of the macro. You use it when you don’t want to see your screen follow the actions of your VBA procedure as you won't be able to see what the macro is doing.

    4. The entire command returns or sets a string value that represents the address of the target document in the active or specified window

    5. Returns a range object in the active or specific window that represents the current region when chart element is selected.

    6. Declares an array called “myArray”. The array has six elements, so I think that is the range of an index that can be used with the statement.

    Sorry for the delay in reply, had some trouble with the last one.

    Cheers

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    4) ActiveCell.Address returns the address of a single cell. ActiveCell is one cell. Also, documents are usually referred to as a workbooks.

    5) ActiveCell.CurrentRegion is a range of cells surrounding the ActiveCell. The VBEditor has a good example of how this property works.

    6) The Dim statement set the highest index of the array to 6. Since no lower bound is specified, the default lower bound is used. The default lower bound, for all arrays, is set with an Option Base statement. The number of elements in the array depends on whether the array is
    Please Login or Register  to view this content.
    The VBEditor Help system is a valuable resource.
    Last edited by mikerickson; 02-26-2008 at 02:19 AM.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    As Mike has said the help is very useful. Select commands you are not familiar with & press F1
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

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.6.0 RC 1