- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 142
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2026-7-16
                
|
- Private Sub Workbook_Open()
- Dim sh, fs$, s As Worksheet, mystr$, a(), C As Range
- Set d = CreateObject("Scripting.Dictionary")
- fs = ThisWorkbook.Path & "\source.xls" 'source.xls目錄與mapping.xls相同
- sh = Array("2.2", "3.0")
- With Workbooks.Open(fs)
- For Each s In .Sheets(sh)
- With s
- a = .Range(.[A1], .[A65536].End(xlUp))
- For i = 1 To UBound(a)
- mystr = .Name & Right(a(i, 1), 4)
- d(mystr) = d.Count
- Next
- End With
- Next
- .Close
- End With
- With Me
- For Each s In .Sheets(sh)
- s.UsedRange.Interior.ColorIndex = -4142
- For Each C In s.UsedRange
- If d.exists(s.Name & C) Then C.Interior.ColorIndex = 6
- Next
- Next
- End With
- End Sub
複製代碼 |
|