- 帖子
- 438
- 主題
- 67
- 精華
- 0
- 積分
- 531
- 點名
- 0
- 作業系統
- win7
- 軟體版本
- office 2010
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2012-10-30
- 最後登錄
- 2025-5-28
|
17#
發表於 2012-11-9 10:29
| 只看該作者
Sub sample()
Dim LastRec As Integer
Dim j As Integer
Dim i As Integer
Dim l As Integer
Dim data() As Range
l = 1
Worksheets("Sheet1").Range("A1").Select
ActiveCell.End(xlDown).Select
LastRec = ActiveCell.Row
For j = 1 To LastRec
i = Application.Match(Sheet1.Cells(1, j), "='C:\Users\Desktop\[1.xlsx]Sheet1'!.Range("A:A"), 0)
If Sheet1.Cells(i, 2).Value <> Sheet2.Cells(i, 2).Value Then
Sheet1.Cells(i, 2).Value = Sheet2.Cells(i, 2).Value
Sheet1.Cells(i, 2).Interior.Color = RGB(255, 200, 255)
End If
Next j
End Sub
請問i = Application.Match(Sheet1.Cells(1, j), "='C:\Users\Desktop\[1.xlsx]Sheet1'!.Range("A:A"), 0)這句哪裡出錯?我想在一個excel內找出桌面的另一個(1.xlsx) excel內相同的名稱,如果他們的值不同就改成另一個(1.xlsx) excel內的值 |
|