Run-time error 381: Could not set the error property. Invalid property array index

  • I haven't used VBA before I just used it recently to create an Automated Entry Form in excel for a current project in my work following a tutorial on Youtube. However, whenever I run the code I get an error (Run-time error 381: Could not set the error property. Invalid property array index) which appears to be due the number of columns in my worksheet (16) and it is supposed to be less than 10 to work with the list function ( that is what I understood after googling the error code.).

    While searching for a solution on internet I found a suggestion of using another method (arrays) rather than using lists. However, I couldn't understand how it works. I would appreciate it if any one can help me overcome this problem.


    Attached is a copy of the excel file.



  • Code
    .lstDatabase.Column = 16


    should be:


    Code
    .lstDatabase.ColumnCount = 16


    although you are only loading a 9 column range in, so I'm not sure why you are specifying 16.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

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