+ Reply to Thread
Results 1 to 6 of 6

Passing an array to a userForm

  1. #1
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Passing an array to a userForm

    I have an array of values created by the code of one userform
    I wish to use this array to populate a second userform. When I try to do this the array is always empty for the initialise procedure of the second userform.
    Please Login or Register  to view this content.
    How can I pass the array to the second form ?
    John

  2. #2
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Passing an array to a userForm

    Perhaps my question would be more interesting if I couched it in a more general way.
    Essentially what I would like to learn is:- How do I pass information from one userform to another using VBA code?
    Although the sub routines generated for each control Like "Private Sub UserForm_Initialize()" have brackets these don't seem to be useable as a means of passing data.
    John

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Passing an array to a userForm

    This is an example:-
    Command Button in Userform 1 takes array form column "A" of sheet, then fills listbox on Userform 1, then passes it to a sub (FillVars) within Userform2 module as below'
    Please Login or Register  to view this content.
    This is the code in Userform2 module, Takes passed array "R" and fills listbox on Userform2.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Passing an array to a userForm

    MickG,
    Thanks for your reply. I shall try to adapt it to my case and let you know how I get on.
    John

  5. #5
    Forum Contributor
    Join Date
    03-30-2010
    Location
    Manchester England
    MS-Off Ver
    Excel 2010
    Posts
    992

    Re: Passing an array to a userForm

    MickG,
    Ive got it to work. Thanks very much for your help
    John

  6. #6
    Registered User
    Join Date
    10-19-2020
    Location
    Lisbon
    MS-Off Ver
    Excel 2019
    Posts
    1

    Re: Passing an array to a userForm

    MickG

    10 years after...
    You saved me.
    THANKS....

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Passing a variable to a userform
    By OldMan62 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-08-2014, 12:58 PM
  2. [SOLVED] Passing Array to OFFSET() - array height parameter
    By GeneralDisarray in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-05-2014, 10:48 AM
  3. [SOLVED] Passing UserForm Variants into an Array [Excel 14/2010 VBA only)
    By lloydgodin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 11:47 AM
  4. Passing Array to VBA
    By Bazman76 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-19-2009, 01:49 PM
  5. Passing the name of an array
    By cbh35711 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-04-2006, 02:14 PM

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