Excel in, ask you a great god why it will next no for?
Private Sub addBtn_Click () Dim CNN As New ADODB. Connection Dim myStr As String CNN. The ConnectionString="Provider=SQLOLEDB; User ID=sa; Password=12345678; Server=b0n1q41 \ SQLEXPRESS LAPTOP - 4; The Database=contract " CNN. Open The Set Rs_Cate=conn. Execute (" SELECT conNum the from list ") Arr_Cate=Rs_Cate. GetRows The Set Rs_Cate=Nothing Dim Arr_CateNumS, Arr_CateNumI Arr_CateNumS=UBound (Arr_Cate, 2) 'get the data in an array subscript For I=3 To Range (" A65536 "). The End (xlUp). Row For Arr_CateNumI=0 To Arr_CateNumS If Cells (I, 2). The Value & lt;> "& amp; Arr_Cate (0, Arr_CateNumI) & amp;" Then Next Arr_CateNumI ElseIf Cells (I, 2). Value="https://bbs.csdn.net/topics/&Arr_Cate (0, Arr_CateNumI) &" Then Next I End the If
CodePudding user response:
The process structure error!
You write code, For statement block and the scope of the If block form "cross"! "Scope" of various blocks, can only be "nested relations" (or say: contains relationship), cannot cross,