zoukankan      html  css  js  c++  java
  • EXCEL 跨表比较数据

    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 "provider=Microsoft.ACE.OLEDB.12.0;Extended Properties='Excel 12.0';data source=" & fullname
        sql = "select * from [" & sheet & "$]"
        rows = conn.Execute(sql).getrows
        conn.Close
      
        Do
            '选择原表单元格
            ActiveSheet.Cells(rowIndex, colIndex).Select
        '去除填充色 With Selection.Interior .Pattern = xlNone .TintAndShade = 0 .PatternTintAndShade = 0 End With cellContents = ActiveCell.Value
    If cellContents
    <> "" Then For i = 0 To UBound(rows, 2) If cellContents = rows(2, i) Then If rows(0, i) <> "apple" Then '填充黄色 With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 65535 .TintAndShade = 0 .PatternTintAndShade = 0 End With End If Exit For End If Next End If rowIndex = rowIndex + 1 Loop Until cellContents = "" End Sub
  • 相关阅读:
    Oracle 创建索引分区
    Shiro SessionManager会话管理器设计概念
    管理表分区
    Oracle 表分区策略
    Oracle 表分区
    参考Shiro的Session定期验证会话失效的线程池
    HDU 3555 Bomb (数位dp)
    POJ 3666 Making the Grade (动态规划)
    Gym
    POJ
  • 原文地址:https://www.cnblogs.com/yipeng-yu/p/5386210.html
Copyright © 2011-2022 走看看