- ©«¤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
|
¦^´_ 1# jackyliu
³oµ{¦¡½X¬O¨Ì¾Ú,ªþÀÉ[TEST]ªº¼Ï¯Ã¤ÀªRªíªº²{¦³µ²ºc¦Ó¼gªº- 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
- For Each R In .RowRange.Columns(1).Cells '¼Ï¯Ã¤ÀªRªíªº¦Cªº²Ä1Äæ
- If InStr(R, "¦Xp") Then
- R.Resize(, .RowRange.Columns.Count + .ColumnRange.Columns.Count).Interior.Color = vbYellow
- With .Parent '¼Ï¯Ã¤ÀªRªíªº¤÷¼h :¤u§@ªí
- .Cells(R.Row, M) = .Cells(R.Row, D_1) - .Cells(R.Row, D_2)
- End With
- End If
- Next
- End With
- End Sub
½Æ»s¥N½X |
|