Results 1 to 16 of 16

Learning differences between ByVal and ByRef

Threaded View

mc84excel Learning differences between... 06-24-2013, 07:50 PM
Leith Ross Re: Learning differences... 06-24-2013, 08:07 PM
shg Re: Learning differences... 06-24-2013, 08:21 PM
mc84excel Re: Learning differences... 06-24-2013, 08:34 PM
shg Re: Learning differences... 06-24-2013, 08:57 PM
mc84excel Re: Learning differences... 06-28-2013, 03:25 AM
mc84excel Re: Learning differences... 06-28-2013, 03:28 AM
Kyle123 Re: Learning differences... 06-28-2013, 03:57 AM
mc84excel Re: Learning differences... 07-02-2013, 08:16 PM
Kyle123 Re: Learning differences... 07-11-2013, 04:01 AM
mc84excel Re: Learning differences... 07-21-2013, 06:43 PM
JosephP Re: Learning differences... 07-22-2013, 02:43 AM
mc84excel Re: Learning differences... 07-23-2013, 08:36 PM
JosephP Re: Learning differences... 07-24-2013, 02:28 AM
mc84excel Re: Learning differences... 07-24-2013, 06:15 PM
JosephP Re: Learning differences... 07-24-2013, 07:48 PM
  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Learning differences between ByVal and ByRef

    I am trying to learn the differences between ByVal and ByRef. Below is a summary of what I have currently learned (or think I have ):
    1. Change original variable passed as argument: ByVal = can not change (passes a copy of the value only), ByRef = can change (passes the original reference) (hence their names)
    2. Passing Arrays: ByVal = Can't do (error), ByRef = Always use for passing arrays as arguments
    3. Passing objects: ByVal = Can not use on objects? ByRef = Always?
    4. Speed: ByVal = slightly slower, ByRef = slightly faster
    5. Argument type: ByRef = must be same variable type passed? ByVal = ?
    6. If not declared: ByVal = not default, ByRef = Default


    My questions:
    1. If there is anything I have incorrect in the above, could someone please let me know?
    2. Is there anything important missing from my summary that I should be learning?
    3. I fail to see any benefits of using ByVal over ByRef (unless you are paranoid about the possibility of altering the original variable). Or am I missing something big here? Please enlighten me if so.

    Thanks for any help/corrections.
    Last edited by mc84excel; 06-28-2013 at 03:26 AM. Reason: Corrections made
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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