+ Reply to Thread
Results 1 to 4 of 4

Dump 2D array into Control

  1. #1
    ExcelMonkey
    Guest

    Dump 2D array into Control

    I want to dump data into a useform control with columns.
    Similar to the control you see when you open up a file
    directory with Detail(i.e. multiple rows and columns). Is
    there a control for this available in VBA? If so can you
    name the column headings? I also want to be able to click
    onto the results of each row/column.

    THanks


  2. #2
    Tom Ogilvy
    Guest

    Re: Dump 2D array into Control

    Use the Listbox

    If you want to use an array, then you can't have headings. If you want
    headings you would have to put your data on a sheet.

    You need to set the properties of the control to show the number of columns
    as you have in your array.

    to simulate headings, you could put labels or textboxes above your listbox.

    Private Sub Userform_Initialize()
    with Listbox1
    .Columncount = 5
    .List = MyArray
    End with
    End Sub


    --
    Regards,
    Tom Ogilvy


    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    > I want to dump data into a useform control with columns.
    > Similar to the control you see when you open up a file
    > directory with Detail(i.e. multiple rows and columns). Is
    > there a control for this available in VBA? If so can you
    > name the column headings? I also want to be able to click
    > onto the results of each row/column.
    >
    > THanks
    >




  3. #3
    Guest

    Re: Dump 2D array into Control

    Thanks Tom. One more quick question. Can you adjust the
    column width of each column within the listbox?

    Thanks


    >-----Original Message-----
    >Use the Listbox
    >
    >If you want to use an array, then you can't have

    headings. If you want
    >headings you would have to put your data on a sheet.
    >
    >You need to set the properties of the control to show the

    number of columns
    >as you have in your array.
    >
    >to simulate headings, you could put labels or textboxes

    above your listbox.
    >
    >Private Sub Userform_Initialize()
    > with Listbox1
    > .Columncount = 5
    > .List = MyArray
    > End with
    >End Sub
    >
    >
    >--
    >Regards,
    >Tom Ogilvy
    >
    >
    >"ExcelMonkey" <[email protected]> wrote

    in message
    >news:[email protected]...
    >> I want to dump data into a useform control with columns.
    >> Similar to the control you see when you open up a file
    >> directory with Detail(i.e. multiple rows and columns).

    Is
    >> there a control for this available in VBA? If so can

    you
    >> name the column headings? I also want to be able to

    click
    >> onto the results of each row/column.
    >>
    >> THanks
    >>

    >
    >
    >.
    >


  4. #4
    Tom Ogilvy
    Guest

    Re: Dump 2D array into Control

    Yes, but an explanation would be long winded. See the Columnwidths (note
    the s on the end) property of the Listbox control.

    An easy way to get there is to go to the object browser in the VBE, in the
    search box, put columnwidths

    Click on one of the columnwidths entries for combobox or listbox and hit F1.

    --
    Regards,
    Tom Ogilvy

    <[email protected]> wrote in message
    news:[email protected]...
    > Thanks Tom. One more quick question. Can you adjust the
    > column width of each column within the listbox?
    >
    > Thanks
    >
    >
    > >-----Original Message-----
    > >Use the Listbox
    > >
    > >If you want to use an array, then you can't have

    > headings. If you want
    > >headings you would have to put your data on a sheet.
    > >
    > >You need to set the properties of the control to show the

    > number of columns
    > >as you have in your array.
    > >
    > >to simulate headings, you could put labels or textboxes

    > above your listbox.
    > >
    > >Private Sub Userform_Initialize()
    > > with Listbox1
    > > .Columncount = 5
    > > .List = MyArray
    > > End with
    > >End Sub
    > >
    > >
    > >--
    > >Regards,
    > >Tom Ogilvy
    > >
    > >
    > >"ExcelMonkey" <[email protected]> wrote

    > in message
    > >news:[email protected]...
    > >> I want to dump data into a useform control with columns.
    > >> Similar to the control you see when you open up a file
    > >> directory with Detail(i.e. multiple rows and columns).

    > Is
    > >> there a control for this available in VBA? If so can

    > you
    > >> name the column headings? I also want to be able to

    > click
    > >> onto the results of each row/column.
    > >>
    > >> THanks
    > >>

    > >
    > >
    > >.
    > >




+ 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