- ©«¤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
|
¦^´_ 6# sillykin
¸Õ¸Õ¬Ý- Option Explicit
- Sub Ex()
- Dim Rng(1 To 3) As Range, i As Integer, E As Range
- With Sheets("Sheet1") ' "Sheet1" ¤u§@ªí¦WºÙ
- .Cells.Interior.ColorIndex = xlNone
- Set Rng(1) = .Range("A:F").SpecialCells(xlCellTypeConstants) '¸ê®Æ®w
- .Range("G:G") = ""
- Set Rng(3) = Rng(1).Rows(1)
- For i = 3 To 5 'CÄæ¡BDÄæ¡BEÄæ¦ì°µ¬°·Ç«h
- .Cells(1, .Columns.Count) = Rng(1).Cells(1, i) 'Äæ¦ì°µ¬°·Ç«h
- Rng(1).Columns(i).AdvancedFilter xlFilterCopy, , .Cells(1, .Columns.Count), True '¿z¿ï¤£«½Æªº¸ê®Æ
- Set Rng(2) = .Range(.Cells(2, .Columns.Count), .Cells(2, .Columns.Count).End(xlDown)) '¿z¿ï¥Xªº¸ê®Æ½d³ò
- For Each E In Rng(2)
- If Application.CountIf(Rng(1).Columns(i), E) > 1 Then ' ¸ê®Æ¦b¸ê®Æ®w¸Ìªº¸ê®Æ¼Æ¤j©ó1
- With Rng(1).Columns(i).Cells
- .Replace E, "=XXX", xlWhole '§ó§ï¬°¿ù»~È
- With .SpecialCells(xlCellTypeFormulas, xlErrors) '¿ù»~Ȫº¯S®í½d³ò¸Ì
- .Value = E '¸m¦^ì¨Óªº¸ê®Æ
- Set Rng(3) = Union(Rng(3), .Cells) '¥[¤J½d³ò
- .Interior.Color = vbYellow
- .Offset(, Rng(1).Columns.Count + 1 - i) = "«ÂнЬd®Ö"
- End With
- End With
- End If
- Next
- Next
- .Cells(1, .Columns.Count).EntireColumn = ""
- Set Rng(3) = Application.Intersect(.Cells, Rng(3).EntireRow) '¾ã¦X¬°¾ã¦C
- End With
- With Sheets("Sheet2")
- .Cells.Clear
- Rng(3).Copy .Range("A1")
- .Cells.Interior.ColorIndex = xlNone
- .Cells.EntireColumn.AutoFit
- End With
- End Sub
½Æ»s¥N½X |
|