the code is work but when i need it to continue search in rows it stop (read command ))Code:Option Explicit Dim xl As New Excel.Application Dim xlsheet As Excel.Worksheet Dim xlsheet1 As Excel.Worksheet Dim xlwbook As Excel.Workbook Private Sub Command1_Click() Dim fI As Integer Dim fI1 As Integer Dim cl As String Dim cl1 As String Dim r As Integer Set xlwbook = xl.Workbooks.Open(App.Path & "\1.xls") Set xlsheet = xlwbook.Sheets.Item(1) Set xlsheet1 = xlwbook.Sheets.Item(2) For fI1 = 1 To 31 If xlsheet1.Cells(fI1, 1) = "" Then xl.ActiveWorkbook.Close False, CStr(App.Path & "\12.xls") Else cl = xlsheet1.Cells(fI1, 1) cl1 = 0 For fI = 1 To 31 If xlsheet.Cells(fI, 1) = cl Then cl1 = cl1 & fI & "," Text1(0).Text = cl1 Else Resume Next End If End If Next fI1 xl.ActiveWorkbook.Close False, CStr(App.Path & "\12.xls") Exit Sub fErrHandler: MsgBox "Error occurred while reading Excel File. Please note that File must be placed in same directory as the program and its name should be Numbers.xls." & vbCrLf & "Error: " & Err.Description, , "Error Reading File" Exit Sub End Sub
how i can make it resume the NEXT for FI in ELSE ????
regards




Reply With Quote