Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Control Array (OfficeXP - Excel)

    Hi,

    it has been a while since i needed one and i have in the mean time upgraded to Office XP. How do i create a control array? i thought that creating a control and then copy and pasting it onto the same form brought up a dialog offering to create an array (or am i getting confused with VB6?)? <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

    any how, what is the easiest way to loop through a load of controls and drop the values into a row of cells?

    TIA

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Brussels, Brussel, Belgium
    Posts
    159
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Control Array (OfficeXP - Excel)

    a control array is only possible in vb

    for vba you could name the controls e.g textbox1 thru textbox10 and then this code inside the userform (untested)

    for loopc=1 to 10
    thisworkbook.sheets(1).range("a1").offset(loopc+1, 0).value=controls("textbox" & cstr(loopc))
    next

  3. #3
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Control Array (OfficeXP - Excel)

    If I recall correctly, Office 95 VBA supported control arrays, but later versions do not.

    John Walkenbach suggests an Array of Controls as an alternative, see example here

    Andrew C

Posting Permissions

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