Could not set the RowSource property. Invalid property value. Error 380

acon08

New Member
Joined
Oct 28, 2024
Messages
9
Office Version
  1. 365
Platform
  1. MacOS
Hi,

Can you please help me why Im getting and Error 380 on my code please. In the red text thats where Im getting the error.

Thank you so so much in advance.

Rich (BB code):
Private Sub cmdAdd_Click()
        Dim sh As Worksheet
        Set sh = ThisWorkbook.Sheets("Worksheet")
        Dim le As Long
        lr = Sheets("Worksheet").Range("A" & Rows.Count).End(xlUp).Row

        '''''''''''''''''Validation'''''''''''''''''''''''''''''''
       
        If Me.txtName.Value = "" Then
        MsgBox "Please Enter the Customer Name", vbCritical
        Exit Sub
        End If
       
        If IsNumeric(Me.txtName.Value) = True Then
        MsgBox "Please Enter the correct name", vbCritical
        Exit Sub
        End If
       
        If Me.txtBoxNo.Value = "" Then
        MsgBox "Please Enter the Box Number!", vbCritical
        Exit Sub
        End If
       
       
        ''''''''''''''''Adding Data''''''''''''''''''''''''''''''
       
        With sh
            .Cells(lr + 1, "A").Value = Me.txtBoxNo.Value
            .Cells(lr + 1, "B").Value = Me.cmbBoxSize.Value
            .Cells(lr + 1, "C").Value = Me.txtName.Value
            .Cells(lr + 1, "D").Value = Me.txtAddress.Value
            .Cells(lr + 1, "E").Value = Me.txtCity.Value
            .Cells(lr + 1, "F").Value = Me.txtPhoneNo.Value
            .Cells(lr + 1, "G").Value = Me.txtReceiverName.Value
            .Cells(lr + 1, "H").Value = Me.txtReceiverAddress.Value
            .Cells(lr + 1, "I").Value = Me.txtReceiverPhoneNo.Value
            .Cells(lr + 1, "J").Value = Me.cmbLocation.Value
        End With
       
        ''''''''''''''''Clearning the Entry Boxes''''''''''''''''''
       
        Me.txtBoxNo.Value = ""
        Me.cmbBoxSize.Value = ""
        Me.txtName.Value = ""
        Me.txtAddress.Value = ""
        Me.txtCity.Value = ""
        Me.txtPhoneNo.Value = ""
        Me.txtReceiverName.Value = ""
        Me.txtReceiverAddress.Value = ""
        Me.txtReceiverPhoneNo.Value = ""
        Me.cmbLocation.Value = ""
       
       
        Call Refresh_data
       
        MsgBox "Data has been added in the Worksheet", vbInformation
        txtBoxNo.SetFocus
       
End Sub


Sub Refresh_data()
        Dim sh As Worksheet
        Set sh = ThisWorkbook.Sheets("Worksheet")
        Dim le As Long
        lr = Sheets("Worksheet").Range("A" & Rows.Count).End(xlUp).Row
       
        If lr = 6 Then lr = 7
       
        With Me.ListBox
            .ColumnCount = 10
            .ColumnHeads = True
            .ColumnWidths = "40,130,90,130,100,80,80,80,90, 130"
            .RowSource = "Worksheet!A7:J" & lr
                       
        End With

            
End Sub

Private Sub cmdDelete_Click()
        Dim X As Long
        Dim Y As Long
        X = Sheets("Worksheet").Range("A" & Rows.Count).End(xlUp).Row
        For Y = 7 To X
       
        If Sheets("Worksheet").Cells(Y, 1).Value = txtSearch.Text Then
        Rows(Y).Delete
       
        End If
        Next Y
       
        ''''''''''''''''Clearning the Entry Boxes''''''''''''''''''
       
        Me.txtBoxNo.Value = ""
        Me.cmbBoxSize.Value = ""
        Me.txtName.Value = ""
        Me.txtAddress.Value = ""
        Me.txtCity.Value = ""
        Me.txtPhoneNo.Value = ""
        Me.txtReceiverName.Value = ""
        Me.txtReceiverAddress.Value = ""
        Me.txtReceiverPhoneNo.Value = ""
        Me.cmbLocation.Value = ""
        Me.txtSearch.Value = ""
       
        MsgBox "Data has been deleted from the Worksheet", vbInformation
        txtBoxNo.SetFocus

End Sub

Private Sub cmdExit_Click()
        If MsgBox("Do you want to exit this form?", vbQuestion + vbYesNo, "Confirmation") = vbYes Then
        Unload Me
        End If
End Sub

Private Sub cmdReset_Click()
        Unload Me
        UserForm1.Show
       
End Sub

Private Sub cmdSearch_Click()
        Dim X As Long
        Dim Y As Long
        X = Sheets("Worksheet").Range("A" & Rows.Count).End(xlUp).Row
        For Y = 7 To X
       
        If txtSearch.Text = Sheets("Worksheet").Cells(Y, 1).Value Then
        txtBoxNo = Sheets("Worksheet").Cells(Y, 1).Value
        cmbBoxSize = Sheets("Worksheet").Cells(Y, 2).Value
        txtName = Sheets("Worksheet").Cells(Y, 3).Value
        txtAddress = Sheets("Worksheet").Cells(Y, 4).Value
        txtCity = Sheets("Worksheet").Cells(Y, 5).Value
        txtPhoneNo = Sheets("Worksheet").Cells(Y, 6).Value
        txtReceiverName = Sheets("Worksheet").Cells(Y, 7).Value
        txtReceiverAddress = Sheets("Worksheet").Cells(Y, 8).Value
        txtReceiverPhoneNo = Sheets("Worksheet").Cells(Y, 9).Value
        cmbLocation = Sheets("Worksheet").Cells(Y, 10).Value
        Me.txtSearch.Value = ""
       
       
        End If
        Next Y

       
End Sub

Private Sub cmdUpdate_Click()
        Dim X As Long
        Dim Y As Long
        X = Sheets("Worksheet").Range("A" & Rows.Count).End(xlUp).Row
        For Y = 7 To X
       
        If Sheets("Worksheet").Cells(Y, 1).Value = txtSearch.Text Then
        Sheets("Worksheet").Cells(Y, 1).Value = txtBoxNo
        Sheets("Worksheet").Cells(Y, 2).Value = cmbBoxSize
        Sheets("Worksheet").Cells(Y, 3).Value = txtName
        Sheets("Worksheet").Cells(Y, 4).Value = txtAddress
        Sheets("Worksheet").Cells(Y, 5).Value = txtCity
        Sheets("Worksheet").Cells(Y, 6).Value = txtPhoneNo
        Sheets("Worksheet").Cells(Y, 7).Value = txtReceiverName
        Sheets("Worksheet").Cells(Y, 8).Value = txtReceiverAddress
        Sheets("Worksheet").Cells(Y, 9).Value = txtReceiverPhoneNo
        Sheets("Worksheet").Cells(Y, 10).Value = cmbLocation
       
        End If
        Next Y
       
        ''''''''''''''''Clearning the Entry Boxes''''''''''''''''''
       
        Me.txtBoxNo.Value = ""
        Me.cmbBoxSize.Value = ""
        Me.txtName.Value = ""
        Me.txtAddress.Value = ""
        Me.txtCity.Value = ""
        Me.txtPhoneNo.Value = ""
        Me.txtReceiverName.Value = ""
        Me.txtReceiverAddress.Value = ""
        Me.txtReceiverPhoneNo.Value = ""
        Me.cmbLocation.Value = ""
        Me.txtSearch.Value = ""
       
        MsgBox "Data has been updated in the Worksheet", vbInformation
        txtBoxNo.SetFocus
End Sub


Private Sub Image2_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)

End Sub


Private Sub ListBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
        txtSearch.Text = ListBox.Column(0)
        If txtSearch.Text = ListBox.Column(0) Then
        txtBoxNo.Text = Me.ListBox.Column(0)
        cmbBoxSize.Text = Me.ListBox.Column(1)
        txtName.Text = Me.ListBox.Column(2)
        txtAddress.Text = Me.ListBox.Column(3)
        txtCity.Text = Me.ListBox.Column(4)
        txtPhoneNo.Text = Me.ListBox.Column(5)
        txtReceiverName.Text = Me.ListBox.Column(6)
        txtReceiverAddress.Text = Me.ListBox.Column(7)
        txtReceiverPhoneNo.Text = Me.ListBox.Column(8)
        cmbLocation.Text = Me.ListBox.Column(9)
       
        End If
       
   
End Sub

Private Sub UserForm_Activate()
        cmbBoxSize.List = Array("JB", "SB", "TV", "LC", "LC/TV")
        cmbLocation.List = Array("Cebu", "Bohol", "Negross Oriental", "Negros Occidental")
        Call Refresh_data
End Sub
 
Last edited by a moderator:

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi *acon08 and Welcome to the Board! This seems like it should be ok. HTH. Dave
VBA Code:
.RowSource = Sheets("Worksheet").Range("A7:J" & lr)
 
Upvote 0
.RowSource = Sheets("Worksheet").Range("A7:J" & lr)
Hi NdNoviceHlp thank you so much for your replace but seems I still get the same error message when I run. See the screenshot below.
 

Attachments

  • Untitled.png
    Untitled.png
    69.3 KB · Views: 8
Upvote 0
Hi *acon08 and Welcome to the Board! This seems like it should be ok. HTH. Dave
VBA Code:
.RowSource = Sheets("Worksheet").Range("A7:J" & lr)
I got the run time error by the way when I insert your code.
 

Attachments

  • Screenshot 2024-10-29 at 06.14.35.png
    Screenshot 2024-10-29 at 06.14.35.png
    41.3 KB · Views: 7
Upvote 0
Is the workbook with the code the active workbook when the code runs?
 
Upvote 0
Than I can't see anything wrong with the code as posted originally. Can you put a sample workbook showing the issue somewhere (e.g. onedrive or dropbox) and post a public link here for us to have a look at?
 
Upvote 0
Than I can't see anything wrong with the code as posted originally. Can you put a sample workbook showing the issue somewhere (e.g. onedrive or dropbox) and post a public link here for us to have a look at?
Hi RoryA sure give me a minute, it works on windows but when i switch to mac, that's where i get the error.
 
Upvote 0
Ah, it will never work on Mac. You cannot use Rowsource on a Mac.
 
Upvote 0

Forum statistics

Threads
1,224,804
Messages
6,181,057
Members
453,015
Latest member
ZochSteveo

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