+ Reply to Thread
Results 1 to 3 of 3

Multi column listbox...

  1. #1
    Registered User
    Join Date
    03-10-2013
    Location
    Ugerløse, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    7

    Multi column listbox...

    Hello everyone,

    I'm sorry if this has been brought up in another thread, but I'm not good at toggling forums and I hadn't been able to find an answer I could understand, with both google or youtube, or in this forum.

    Well, my issue is; as I'm a Role playing nerd, I have started to create a charactersheet for this purpose. In the past I have created this in excel only, with a lot of "if, and, else" codes, references to various cells, adding and subtracting values, but this time I wanted to do the coding in VB, as I would love to learn VB (started a few days ago, and spend some hours reading about VB and a few trying to create some codes, I don't completely understand the dim functions, loop functions ect. yet, but I'm getting there).

    I started off by creating one tab/sheet for presentations and another for data, and I chose to use userforms made in VB as the means of choosing between the various options presented in a typical charactersheet/rulebook.

    So fare I succeed in making a userform, brought up by a run-macro when pushing a icon on the presentations sheet. In this userform I have placed a listbox, this listbox is feed with information's from a 3 column list, with x rows, on the datasheet. I have set up the listbox to display all the 3 columns, I have succeeded with returning one of the values in one of the 3 columns, to what ever cell I chose in the presentations sheet, by setting the BoundColumn under property of the listbox and then creating a command-bottom applying selection in listbox when clicked.

    My problem is, that this listbox contains 3 values and I want to use all values in various cells, ex. worksheets("sheet1").cells(1, 1) = listbox1.(selected row, column 1) and the worksheets("sheet1").cells(1, 2) = listbox1.(selected row, column 2).

    Anyone who can tell me what function I need to use and write in an command-bottom or something, so that I can place each column value in a specific cell, in a specific worksheet, and in a very simple and basic way?

    Btw... I'm using excel 2012 and the build in VB functions it provides, I don't know it there are any differences between various versions of excel and VB.



    In advance, Thank! for what every help you can provide me.

    Kind Regard
    Martin Kristensen (alias; the VB Noob! :p)

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

    Re: Multi column listbox...

    Try this:-
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-10-2013
    Location
    Ugerløse, Denmark
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Multi column listbox...

    Quote Originally Posted by MickG View Post
    Try this:-
    Please Login or Register  to view this content.
    Very nice, it seems to work on creating the above codes and I understand whats is going on. Now, its time to try implementing it into my work and see if I learned anything :p

    Thanks for your help MickG!

+ 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