|
Sub DataSplit()
Dim Arr As Variant, i%
Dim Cn As Object, StrCn$, StrSQL$
Arr = Split(InputBox("请输入试管编号,用@分隔开", "试管编号"), "@")
Set Cn = CreateObject("ADODB.Connection")
StrCn = "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=Excel 12.0;Data Source=" & ThisWorkbook.FullName
Cn.Open StrCn
For i = 0 To UBound(Arr)
Worksheets.Add(after:=Worksheets(Worksheets.Count)).Name = Arr(i)
StrSQL = "Select * From [App采样信息$A3:T] Where 样品管编号='" & Arr(i) & "'"
Range("A1").CopyFromRecordset Cn.Execute(StrSQL)
Next i
End Sub |
评分
-
1
查看全部评分
-
|