Public Sub Compare(fullname As String, sheet As String) Dim conn, sql, rows, i, cellContents ,rowIndex, colIndex rowIndex = 2 colIndex = getColumnIndex("Name") '获取目标表数据 Set conn = CreateObject("adodb.connection") conn.Open "provid…
大家都知道用Update修改单个表的使用方法,现在来看一下用update 跨表修改数据: 首先创建表 a 然后创建表b 现在要把表b的company 根据ID更新到表a 方法一: update a set a.company = b.company from b bwhere a.id =b.id 方法二:update a set a.company =b.company from a inner join b on b.id =a.id 结果如图: 搞定了…
Sub 跨表转置() Dim Wb As Workbook Dim Sht As Worksheet Dim oSht As Worksheet Dim Rng As Range Dim Index As Long Const HeadRow As Long = 12 Set Wb = Application.ThisWorkbook Set Sht = Wb.Worksheets("模板") Set oSht = Wb.Worksheets("数据表") With…
一.数组方案 Sub CustomFilter() Dim Rng As Range, Arr As Variant Dim EndRow As Long, EndCol As Long Dim i As Long, j As Long Dim n As Long Dim StartDate, EndDate Dim BeginTime, EndTime Dim Brr() As String Dim StartTime As Variant Dim UsedTime As Variant St…
Sub FillNewToYellow() Dim dic Dim oldArr(), updatedArr() On Error Resume Next If Worksheets("old") Is Nothing Then MsgBox "Missing old sheet" ElseIf Worksheets("updated") Is Nothing Then MsgBox "Missing updated sheet&quo…