- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
        
|
¦^´_ 3# jackyliu - Sub Ex()
- Dim D_1, D_2, R As Range, M As Integer
- With Sheets("TEST").PivotTables(1) '¤u§@ªíªº¹ô¤@Ó,¼Ï¯Ã¤ÀªRªí.
- .Parent.Cells.Interior.ColorIndex = xlNone
- With .ColumnRange
- .Cells(1, .Columns.Count + 1).EntireColumn.Clear '¼Ï¯Ã¤ÀªRªíªºÄæ¦ìªº³Ì¥kÃ䪺¤U¤@Äæ: ¾ãÄæ ¥þ³¡²M°£
- End With
- Application.DisplayAlerts = False
- .SourceData = Sheets("RAW").Range("A1").CurrentRegion.Address(, , xlR1C1, 1)
- '§ó·s¸ê®Æ®wªº¦ì¸m CurrentRegion¤£·|¥]§t¦³ªÅ¥Õªº¸ê®Æ
- 'ì¥ý¸ê®Æ®wªº¦ì¸m=> A:D ªº¾ãÄæ¥]§t¦³ªÅ¥Õªº¸ê®Æ
- Application.DisplayAlerts = True
- .PivotCache.Refresh
- With .ColumnRange '¼Ï¯Ã¤ÀªRªíªºÄæ¦ì
- M = .Cells(1, .Columns.Count + 1).Column '¼Ï¯Ã¤ÀªRªíªºÄæ¦ìªº³Ì¥kÃ䪺¤U¤@Äæ
- D_1 = CDate(Application.Large(.Rows(2), 1)) '³Ì¤jªº¤é´Á
- D_2 = CDate(Application.Large(.Rows(2), 2)) '¦¸¤@¤éªº¤é´Á
- D_1 = .Rows(2).Find(D_1, LookIn:=xlValues).Column '³Ì¤j¤é´Áªºøó¸¹
- D_2 = .Rows(2).Find(D_2).Column '¦¸¤@¤éªºøó¸¹
- End With
- Set R = .RowRange.Columns(1).Cells(2)
- Do While Not Intersect(R, .RowRange.Columns(1)) Is Nothing
- If InStr(R, "¦Xp") Then
- R.Resize(, .RowRange.Columns.Count + .ColumnRange.Columns.Count).Interior.Color = vbYellow
- End If
- With .Parent '¼Ï¯Ã¤ÀªRªíªº¤÷¼h :¤u§@ªí
- .Cells(R.Row, M) = .Cells(R.Row, D_1) - .Cells(R.Row, D_2)
- End With
- Set R = R.Offset(1)
- Loop
- End With
- End Sub
½Æ»s¥N½X |
|