+ Reply to Thread
Results 1 to 6 of 6

Loading MultiColumn Combobox in a Userform

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Loading MultiColumn Combobox in a Userform

    Hi,

    I am trying to load a multicolumn combobox with the following code

    Please Login or Register  to view this content.
    As you would see I am loading columns 1,3,4 and 23 from worksheet "WO" if the value in column 23 is greater than 0. The first two rows of this worksheet contain the header information. The data starts from row 3 onwards. This code works most of the time except that I am facing two situations as under:

    a) If there is no data in the worksheet (last used row is 2), I get "Run-time error '91': Object variable or With block variable not set." I get the same error if there is data but none fit the criterion "column 23 > 0".

    b) if there are 2 or more records to be displayed in the combobox, the information is displayed correctly in the columns. However, if there is only one record, each column is displayed one below the other as a row and I am able to select any row.

    I have been trying to get over this problem but do not seem to find the right solution.

    Would be grateful if some one can point out why I getting these problems and edit the code suitably for me.

    Thanks in advance,

    Anand Hattangady
    Last edited by anandvh; 01-22-2014 at 06:28 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: Loading MultiColumn Combobox in a Userform

    will you upload a sample file please?

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Loading MultiColumn Combobox in a Userform

    Where do you get the error?

    By the way d will always be >0 as you set it to 1 before the loop.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Re: Loading MultiColumn Combobox in a Userform

    Thanks Mahaveer and Noorie for your interest.

    I have attached the file
    Attached Files Attached Files

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Loading MultiColumn Combobox in a Userform

    Which of the 13 userforms should we be looking at and how can we reproduce the errors/behaviour you describe?

  6. #6
    Registered User
    Join Date
    11-15-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2007
    Posts
    97

    Re: Loading MultiColumn Combobox in a Userform

    Userform RcptForm. This is linked to worksheet WO. You can reproduce the problem with the display of the multicolumns by keeping only one record in row 3. The error 91 comes up when there are no records, ie last row if 2 which is the header information.

    Thanks for any assistance in understanding what's going wrong.

    Anand Hattangady

+ 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. Working with too many combobox multicolumn.
    By nuclearspy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-08-2012, 07:21 PM
  2. Multicolumn Combobox
    By hydrojoe11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2008, 01:27 PM
  3. Multicolumn combobox
    By Gromit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2006, 12:14 PM
  4. MultiColumn ComboBox
    By Paul Smith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-03-2005, 02:05 AM
  5. [SOLVED] MultiColumn ComboBox Value set/display
    By Jim Zeeb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-13-2005, 05:05 AM

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