22,206
社区成员
发帖
与我相关
我的任务
分享
Sub test()
n = Range("a65535").End(xlUp).Row
If n = 2 Then Exit Sub
Dim ids As String
For i = 2 To n
ids = ids & Range("a" & i).Value & ","
Next
ids = Left(ids, Len(ids) - 1)
Sql = "select 序号,语文,数学,英语 from 成绩计算$ where 序号 in (" & ids & ")"
MsgBox Sql
End Sub
Sql = "select 序号,语文,数学,英语 from 成绩计算$ where 序号 in (" & "1,2,3" & ")"