+ Reply to Thread
Results 1 to 7 of 7

Problem in Returning Values from a Multi-column Listbox (ActiveX)

  1. #1
    Registered User
    Join Date
    06-06-2006
    MS-Off Ver
    2010, 365
    Posts
    39

    Problem in Returning Values from a Multi-column Listbox (ActiveX)

    Hi,

    I need to achieve the following:

    1. insert an ActiveX listbox (single select, 4 columns) in the worksheet (Sheet1)
    2. populate the listbox with a range in another sheet (sheet2)
    3. after populating the list, whenever the user clicks on a row, a userform should pop-up with all the values in the 4 columns of the listbox in 4 different textboxes
    4. user may want to edit the data, which may then be committed to the data sheet (sheet2) and refreshed in the listbox as well.

    I am stuck at the 3rd step. Whenever I try to access the listbox range, the following error is generated:

    Run-time error '1004':

    Method 'Range' of object '_Worksheet' failed
    The code that I am using is:

    Please Login or Register  to view this content.
    Is my approach wrong? Or some problem with my coding? Please help.

    Peace,

    Shivboy

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Shivboy,

    I tested your code without the UserForm and it works fine. Did you set the ListFillRange property manually or by code? If it isn't set, you will get this error.

    My Test Code
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    06-06-2006
    MS-Off Ver
    2010, 365
    Posts
    39
    Hi Leith,

    I have set the ListFillRange property manually in the Properties of the listbox. But it still isn't working!

    Shivboy

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Shivboy,

    Can you post your workbook?

    Thanks,
    Leith Ross

  5. #5
    Registered User
    Join Date
    06-06-2006
    MS-Off Ver
    2010, 365
    Posts
    39
    Hi Leith,

    Here is the file attached. I forgot to mention one thing, I am using Excel 2007, if that makes a difference.

    Shivboy
    Attached Files Attached Files

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The workbook in the zip is not a 2007 format.

    I can't see why you are working like this, why not have a Listbox on the UserForm? You can't define a cell like that, try

    Please Login or Register  to view this content.
    Last edited by royUK; 09-16-2007 at 02:18 PM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Shivboy,

    Sorry, I don't have 2007 on my machine. I did try to run your workbook, but with no success. Someone with 2007 needs to help you with this code problem.

    Sincerely,
    Leith Ross

+ 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