- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 251
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-19
|
¦^´_ 4# jcchiang - Sub ex()
- Dim Ay(), Ary(), A As Range, C As Range
- With Sheet1
- For Each A In .Range(.[B4], .[IV4].End(xlToLeft)).SpecialCells(xlCellTypeConstants)
- For Each C In .Range(.[A5], .[A5].End(xlDown))
- If InStr(C, "-") > 0 Then
- ar = Split(C, "-")
- Else
- ar = Split(C & "-(", "-")
- End If
- ReDim Ay(UBound(ar) + 4)
- Ay(0) = A: Ay(1) = ar(0): Ay(2) = Left(ar(1), InStr(ar(1), "(") - 1)
- If IsDate(.Cells(C.Row, A.Column)) Then
- Ay(3) = .Cells(C.Row, A.Column): Ay(4) = .Cells(C.Row, A.Column + 1)
- Ay(5) = Ay(4) - Date
- ElseIf InStr(.Cells(C.Row, A.Column), "~") > 0 Then
- Ay(3) = Evaluate(Replace(.Cells(C.Row, A.Column), "~", "+")) / 2
- Ay(4) = .Cells(C.Row, A.Column + 1): Ay(5) = Ay(3) - Ay(4)
- Else
- GoTo 10
- End If
- ReDim Preserve Ary(s)
- Ary(s) = Ay
- Erase Ay: s = s + 1
- 10
- Next
- Next
- End With
- Sheet2.UsedRange.Offset(2) = ""
- Sheet2.[A3].Resize(s, 6) = Application.Transpose(Application.Transpose(Ary))
- End Sub
½Æ»s¥N½X |
|