|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 查询()
Dim cnn As Object
Dim Sql As String
Set cnn = CreateObject("ADODB.CONNECTION")
cnn.Open "Provider=Microsoft.Jet.OleDb.4.0;Extended Properties='Excel 8.0;HDR=YES'; Data Source=" & ThisWorkbook.FullName
Sql = "SELECT 姓名,工种, MIN(instr('高级中级低级',级别)) AS T from [Sheet1$a1:c] GROUP BY 姓名,工种"
Sql = "select 姓名,工种,SWITCH(T=1,'高级',T=3,'中级',T=5,'低级') FROM (" & Sql & ")"
[e:h] = ""
[e2].CopyFromRecordset cnn.Execute(Sql)
cnn.Close: Set cnn = Nothing
End Sub |
评分
-
1
查看全部评分
-
|