|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
lpzxhjp 发表于 2012-4-17 11:21
谢谢赵老师,附件已上传。 - Private Sub CommandButton1_Click()
- Dim cnn As Object
- Dim myTable As String
- Dim SQL$, s$, i&, a
- Set cnn = CreateObject("adodb.connection")
- a = [c3:R3&""]
- For i = 1 To UBound(a)
- s = s & ",iif(a." & a(i) & "=b." & a(i) & ",'√','×')"
- Next
- SQL = "select a.考场,a.考号" & s & " from [录入员1$" & Sheets("录入员1").[a3].CurrentRegion.Address(0, 0) & "] a left join [录入员2$" & Sheets("录入员2").[a3].CurrentRegion.Address(0, 0) & "] b on a.考场=b.考场 and a.考号=b.考号"
- cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='Excel 8.0;imex=1';Data Source=" & ThisWorkbook.FullName
- Range("A4:R65536").ClearContents
- [a4].CopyFromRecordset cnn.Execute(SQL)
- cnn.Close
- Set cnn = Nothing
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|