|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
有点费工付
- Set SHX = Worksheets("汇总")
- SHX.Range("A5:HZ65536").Interior.ColorIndex = xlNone '取消单元填充色
-
- Rem 文件清单
- FileArr = FileAllArr(ThisWorkbook.Path, "*.xls?", ThisWorkbook.Name, True, False) '//含子文件夹;文件路径
- For ICOL = 3 To SHX.Range("IU4").End(xlToLeft).Column
-
- Rem 提示信息,在状态栏显示
- Application.StatusBar = "当前公司名是:" & SHX.Cells(4, ICOL).Value
- DoEvents
-
- Rem 每一列是一个文件,含:B
- For I = 0 To UBound(FileArr)
- Filename = GetPathFromFileName(FileArr(I), False)
- If InStr(Filename, "-" & SHX.Cells(4, ICOL).Value & "B") > 0 Then
-
- Rem 提示信息,在状态栏显示
- Application.StatusBar = "当前公司名是:" & SHX.Cells(4, ICOL).Value & " 对应工作簿是:" & Filename
- DoEvents
-
- Set WB = Workbooks.Open(FileArr(I))
- For Each SHW In WB.Worksheets
- If SHW.Name = "汇总" Then
- Rem 假设每个表 都在:E列,而且每行和汇总表的相同
- For IROW = 5 To SHX.Range("A65536").End(3).Row
- If IsNumeric(SHX.Cells(IROW, ICOL).Value) = True And IsNumeric(SHW.Cells(IROW, 5).Value) = True Then
- If SHX.Cells(IROW, ICOL).Value <> SHW.Cells(IROW, 5).Value Then
- Rem 标注为:黄色,红色背景
- SHX.Cells(IROW, ICOL).Interior.Color = 255 '//65535
- End If
- End If
- Next
- End If
- Next
- WB.Close False
- Set WB = Nothing
-
- End If
- Next
- Next
复制代码 |
评分
-
1
查看全部评分
-
|