Range not appearing in ListBox

  • Hi.
    I am using the bellow code but the ListBox only shows data in column J. What am I doing wrong?


    Code
    Private Sub UserForm_Initialize()
    ListBox1.List = Worksheets("Tides").Range("J3:P17").Value
    End Sub
  • Re: Range not appearing in ListBox


    Please use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window.


    This is covered in the Forum Rules that you agreed to.

  • Re: Range not appearing in ListBox


    Sorry. Have edited my last post and have also worked out the problem by changing the number of columns in the listbox properties.

  • Re: Range not appearing in ListBox


    Quote from josh1981;641232

    Hi.
    I am using the bellow code but the ListBox only shows data in column J. What am I doing wrong?


    Code
    Private Sub UserForm_Initialize()
    ListBox1.List = Worksheets("Tides").Range("J3:P17").Value
    End Sub


    ListBox control only accept one dimensional array and you are providing it two dimensional array.


    If you want to add then you can do it like this:


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!