+ Reply to Thread
Results 1 to 2 of 2

Object required = Passing Listbox to a custom function

  1. #1
    Forum Contributor
    Join Date
    06-20-2021
    Location
    UK
    MS-Off Ver
    2016
    Posts
    126

    Object required = Passing Listbox to a custom function

    This is function that i have put in my userform module. The idea is to populate listbox from a select range, and remove empty items within userform_init module.

    Please Login or Register  to view this content.
    I have all of my code in userform. My object hierarchy is as follows: FindReplace (Userform) => FANumbers (Listbox)

    When I try to use the function in userform_init procedure to clear empty items in the listbox, I get Object Required error?

    Please Login or Register  to view this content.
    This doesn't work even when I change data type from msforms.listbox to listbox in the function parameter.

    I also tried removing Me but still gives the same error.

    Now there is an alternative way that works such as:
    Please Login or Register  to view this content.
    But I am trying to learn how to pass a value to a function for my own knowledge sake. Please guide me how to pass the listbox argument.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,517

    Re: Object required = Passing Listbox to a custom function

    Change ListBox to msFoms.ListBox
    Please Login or Register  to view this content.
    However, if the RowSource perperty is used, you will get error at .RemoveItem/

+ 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. [SOLVED] Object required with 11 column listbox
    By JamesT1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-17-2022, 03:46 AM
  2. [SOLVED] Error 424 Object required when adding items to multi-column listbox
    By Habakkuk123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-04-2021, 02:45 PM
  3. [SOLVED] Passing name of shape to custom function
    By malcmail in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-19-2020, 10:44 AM
  4. How do I go about passing a custom class object from Excel to Word?
    By AnthonyGFS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-29-2018, 07:40 AM
  5. [SOLVED] List of items in a userform listbox, object required error in code
    By jayherring86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2015, 09:10 AM
  6. [SOLVED] Error 424 Object Required when passing range as parameter
    By carrick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-29-2006, 06:10 PM
  7. Passing an array as argument for custom Function
    By in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2005, 01:06 PM

Tags for this Thread

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