Dear All,

I m not able to update listbox rowsource when combox selection will change.

PLease help.My code are as below.
Option Explicit
Dim Mydata As Range
Dim osheet As Excel.Worksheet
Dim strng As String
Dim sheet As Worksheet

Private Sub ComboBox1_Change()
Me.ListBox1.RowSource = ""
strng = Me.ComboBox1.Value
For Each osheet In ActiveWorkbook.Sheets
     If InStr(osheet.Name, strng) Then
        
        osheet.Activate
        Set Mydata = ActiveSheet.Range(Range("A2").End(xlDown), Range("A2").End(xlToRight))
        'Set c = Mydata.Cells(Mydata.Rows.Count, 1).Offset(1)
        With Me
        Me.ListBox1.ColumnHeads = False
        Me.ListBox1.RowSource = "Mydata"
              
        End With
     End If
     'Sheets(osheet).Visible = False
     Next osheet
'Sheets("Home").Activate
'Application.ScreenUpdating = True

End Sub

Private Sub UserForm_Initialize()

Me.ComboBox1.RowSource = "AccountName"
Me.ComboBox1.Value = ComboBox1.List(0)

End Sub