I am creating a basic data collect form with 10 textboxes and adding to a new sheet called Database. I have couple of options like Save
, Reset
, Delete
, Exit Form
, Search
and Modify
.
My file works perfectly in my system as well as in other systems. But when I am running this in Office365 and in some other version of excel, I am getting the below error:
Run-time error "380", Could not set the RowSource property. Invalid property value
When I debug I found that when I am initializing my form, I am resetting it. Below is the code for reset sub.
Sub Reset()
Dim iRow As Long
iRow = [Counta(Database!A:A)] 'Identifying last row
With frmForm
.txtVendor.Value = ""
.txtAddress.Value = ""
.txtPOC.Value = ""
.txtEmail.Value = ""
.txtContact.Value = ""
.txtSpecialization.Value = ""
.txtBand.Value = ""
.txtBU.Value = ""
.txtYear.Value = ""
.txtRemark.Value = ""
.txtSearch.Value = ""
.lstDatabase.ColumnCount = 13 'As we have total 13 columns/data to populate
.lstDatabase.ColumnHeads = True 'Our database has headers
.lstDatabase.ColumnWidths = "40,95,125,85,85,85,95,50,85,40,120,70,70"
If iRow > 1 Then
.lstDatabase.RowSource = "Database!A2.M" & iRow
Else
.lstDatabase.RowSource = "Database!A2.M2"
End If
End With
End Sub
The error is getting triggered in below line for both else or if part:
for if part
.lstDatabase.RowSource = "Database!A2.M" & iRow
for else part
.lstDatabase.RowSource = "Database!A2.M2"
I tried changing the source as below but still getting the same error:
.lstDatabase.RowSource = Sheets("Database").Range("A2:M").Address (external:=true)