Results 1 to 3 of 3

Thread: Wrong number of arguments or invalid property assignment

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2021
    Posts
    2

    Wrong number of arguments or invalid property assignment

    Hello
    I have code for combobox as below ,but i cant not run .
    Please let me know where it is wrong
    Thanks.

    Private Sub UserForm_Initialize()
    Dim ws As Worksheet
    Dim Rowcount As Double
    Dim i As Integer

    Set ws = ThisWorkbook.Sheets("allproduct")
    Rowcount = Excel.WorksheetFunction.CountA(ws.Range("A:A"))
    Me.cb_product.Clear
    Me.cb_product.AddItem ""
    For i = 2 To Rowcount
    Me.cb_product.AddItem ws.Name("B" & i)
    Next
    End sub

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,440

    Re: Wrong number of arguments or invalid property assignment

    AddItem ws.Name?????

    Shouldn't that be ws.Range?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2021
    Posts
    2

    Re: Wrong number of arguments or invalid property assignment

    Quote Originally Posted by Zvoni View Post
    AddItem ws.Name?????

    Shouldn't that be ws.Range?
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width