With Sheets(Sh)
If Application.CountA(.Range("B7:B65536")) = 0 Then
For Each A In .Range(.[B7], .[B65536].End(xlUp))
With Sheets(Dh)
d(A.Value) = d(A.Value) + 1 Set B = .Columns("A").Find(A, lookat:=xlWhole).Offset(, 6)
A.Offset(, 2).Resize(, 24).Copy B.Offset(d(A.Value), 0)
End With
Next A
End If
End With
With Sheets(Sh)
If Application.CountA(.Range("B7:B65536")) = 0 Then
For Each A In .Range(.[B7], .[B65536].End(xlUp))
With Sheets(Dh)
d(A.Value) = d(A.Value) + 1
Set B = .Columns("A").Find(A, lookat:=xlWhole).Offset(, 6)
A.Offset(, 2).Resize(, 24).Copy B.Offset(d(A.Value), 0)
End With
Next A
End If
End With紅字是Sheets(Dh)區段
藍色字是Sheets(Sh)區段
所以For Each A In .Range(.[B7], .[B65536].End(xlUp))
這個A是變數是Sheets(Sh).Range(.[B7], .[B65536].End(xlUp))的每個儲存格作者: b9208 時間: 2010-5-27 23:12
感謝指導
我把 Columns("A") 與 Each A,前者A欄,後者變數A。
如把變數A改為變數H,應該比較清楚。
With Sheets(Sh)
If Application.CountA(.Range("B7:B65536")) = 0 Then
For Each H In .Range(.[B7], .[B65536].End(xlUp))
With Sheets(Dh)
d(H.Value) = d(H.Value) + 1
Set B = .Columns("A").Find(H, lookat:=xlWhole).Offset(, 6)
H.Offset(, 2).Resize(, 24).Copy B.Offset(d(H.Value), 0)
End With
Next H
End If
End With