I get run time error 380" Could not set the Row Source property. Invalid Property Value.

Saru

New Member
Joined
May 15, 2020
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Not sure how to fix this error. It is pointing to the below section of the code. Thank you!

VBA Code:
Dim iRow As Long
    iRow = [Counta(Database!A:A)] 'identfying the last row to add
     
    .lstDB.ColumnCount = 12
    .lstDB.ColumnHeads = True
    .lstDB.ColumnWidths = "30,30,60,75,75,40,75,30,40,30,70,70"
    
        If iRow > 1 Then 'reference or assign rowsource of database to listbox
        .lstDB.RowSource = "Database!A2:L" & iRow
        Else
        .lstDB.RowSource = "Database!A2:L2"
        End If
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
In a situation the iRow variable evaluates to 0 (zero) the Row Source property can not be set.
 
Upvote 0
Are you saying that the data row is blank or 0 and that is why i get the error? Doesn't the heading count as 1 row? I didn't have the issue with the code previously. This is new. What is that i need to do? Thanks, Saru
 
Upvote 0
Check the name of the sheets, you must have a sheet with this name: "Database"
Check that the name does not have spaces to the left or to the right.
 
Upvote 0
Hi Dante,
I did not make any changes to the worksheet name or to the listbox name. I reviewed the code once again and I was getting the same error. I decided to create a new workbook with same names and it worked fine. May be it was some sort of excel glitch. Who knows. The new workbook works fine. Thanks, Saru
 
Upvote 0

Forum statistics

Threads
1,215,432
Messages
6,124,859
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top