he problem is that the code is not working with me and gives "type mismatch error"
   Private Sub UserForm_Initialize()
   Dim cn As ADODB.Connection
   Dim rs As ADODB.Recordset
     Set cn = New ADODB.Connection
    cn.ConnectionString = _
                     "Provider=Microsoft.ACE.OLEDB.12.0;" & _
                     "Data Source=F:\Book1.xlsx;" & _
                     "Extended Properties='Excel 12.0 Xml;HDR=YES';"
    
    
      
    cn.Open
     Set rs = New ADODB.Recordset
    
    rs.ActiveConnection = cn
    rs.Source = "select [date] ,[factory] ,[records] from [sheet1$]"
    
    rs.Open
     With Me.ListBox1
     .ColumnCount = rs.RecordCount
     .List = Application.WorksheetFunction.Transpose(rs.GetRows)
      
     End With
    rs.Close
    cn.Close