- ©«¤l
- 234
- ¥DÃD
- 19
- ºëµØ
- 0
- ¿n¤À
- 276
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows XP
- ³nÅ骩¥»
- office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-1-7
- ³Ì«áµn¿ý
- 2021-10-7
|
¦^´_ 2# PJChen
¥¨¶°½Ð©ñ©ó"¥]§÷Åçºâ"ÀÉ®×
¸ê®Æ¦ì¸m¥Hìªþ¥ó³]©w,¦p¦³¤£¦P½Ð¦Û¦æ½Õ¾ã
Sub ex()
Dim Arr As Variant, d As Object, a As Variant, b As Variant, X%, Y%
Set d = CreateObject("Scripting.Dictionary")
With Workbooks.Open(ThisWorkbook.Path & "\" & "¥]§÷³øªí.xlsx").Sheets("¥]§÷")
Set Arr = .Range(.[b5], .[P7]) '¸ê®Æ½d³ò
End With
For X = 1 To Arr.Rows.Count
For Y = 4 To Arr.Columns.Count
If Arr(X, Y).HasFormula Then '§PÂ_Àx¦s®æ¬O§_¬°¤½¦¡
If Arr(X, Y).FormulaR1C1Local Like "*+*" Then '§PÂ_¤½¦¡¤º¬O§_¬°"+"
d(Arr(X, 1) & Arr(X, Y).Offset(-3 - X)) = Split(Arr(X, Y).FormulaR1C1Local, "+")(1) '¸ê®Æ¼g¤J¦r¨å
Else '§PÂ_¤½¦¡¤º¬°"-"
d(Arr(X, 1) & Arr(X, Y).Offset(-3 - X)) = "-" & Split(Arr(X, Y).FormulaR1C1Local, "-")(1) '¸ê®Æ¼g¤J¦r¨å
End If
End If
Next
Next
Workbooks("¥]§÷³øªí.xlsx").Close False
For Each a In Range([C16], [C18]) '¥]§÷°Ï¶¡
For Each b In Range([F2], [F2].End(2)) '¤é´Á°Ï¶¡
If d.exists(a & b) Then Cells(a.Row, b.Column) = d(a & b) '±N¦r¨å¸ê®Æ¼g¤J¬Û²ÅªºÀx¦s®æ
Next
Next
Set d = Nothing
End Sub |
|