- ©«¤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
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2015-11-24 14:45 ½s¿è
¦^´_ 34# Airman
°Ñ¦Òã´£³¡ªL ª©¥D»¡©ú
¸Õ¸Õ¬Ý- Option Explicit
- Dim Sh As Worksheet '³o¼Ò²Õªº¨p¥ÎÅܼÆ
- Private Sub CommandButton1_Click()
- Dim b As Range, Rng As Range
- Dim xRng(1 To 2) As Range
- With Sheets("Sheet1") 'n§e²{ªº¤u§@ªí
- Sheets("DATA").Range("J7", "P" & .[R6] + 5).Copy .[J7]
- Set Rng = .Range("J7:P" & .[R6] + 5) '©Ò½Æ»s¸ê®Æªº½d³ò
- Rng.Interior.ColorIndex = xlNone
- Set xRng(1) = .Range("T7:T" & .[R6] + 5) 'TÄ檺½d³ò
- If Application.Count(xRng(1)) = 0 Then Exit Sub 'TÄæ¨S¦³´Á¼Æ®ÉÂ÷¶}µ{¦¡
-
- Set Sh = Sheets.Add(Sheets(1)) '¼W¥[¤@¤u§@ªí
- Application.ScreenUpdating = False '¦pªG¿Ã¹õ§ó·s¥\¯à¬O¶}±Òªº«h¬° True
- For Each b In xRng(1).SpecialCells(xlCellTypeConstants) 'TÄæ [¦³´Á¼ÆªºÀx¦s®æ]½d³ò
- Ex_ChiCK Union(Rng.Rows(.Range("R" & b.Row)), Rng.Rows(.Range("R" & b.Row) - .[T3]), Rng.Rows(.Range("R" & b.Row) - .[T3] * 2)) '´Á§Oªº°}¦C
- 'Ex_ChiCK Union(Rng.Rows(.Range("R" & b.Row) - .[T3] * 2), Rng.Rows(.Range("R" & b.Row) - .[T3]), Rng.Rows(.Range("R" & b.Row))) 'ËÂà´Á§O
- Next
- .Activate '±N¥Ø«eªº¤u§@ªí¦¨¬°¨Ï¥Î¤¤ªº¤u§@ªí¡Cµ¥¦P©ó«ö¤@¤U¤u§@ªí¯Á¤Þ¼ÐÅÒ¡C
- .[a1].Select '·Æ¹«°±¯d¦bSheets(2)ªº A1
- End With
- Application.DisplayAlerts = False '¦pªG¥¨¶°¦b°õ¦æ®É Microsoft Excel Åã¥Ü¯S©wªºÄµ§i©M°T®§«h¬° True
- Sh.Delete '§R°£:¤u§@ªí
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
- Private Sub Ex_ChiCK(Rng As Range) '°Æµ{¦¡ ¶·¶Ç°e°Ñ¼Æ
- Dim Ar(), i As Variant, E As Variant, X As Variant, M As Integer
- Ar = Array(4, 45, 8)
- Rng.Copy Sh.[a1] '½Æ»s¤T´Á¸ê®Æ
- For i = 1 To 49
- X = Application.CountIf(Sh.UsedRange, i) 'x = 3 :¦P¤@¸¹½X¤T´Á³£¥X²{
- If X = 3 Then E = E & IIf(E <> "", ",", "") & i '¬ö¿ý¸¹½X
- Next
- X = Split(E, ",") '¥X²{3¦¸ªº¸¹½X,¸m¤J°}¦C
- For Each E In X
- For i = 1 To Rng.Areas.Count
- '¶Ç¦^ Areas ¶°¦X¡A¦¹¶°¦X¥Nªí¦h«½d³ò¤¤ªº©Ò¦³½d³ò
- M = Application.Match(Val(E), Rng.Areas(i).Cells, 0)
- Rng.Areas(i).Cells(M).Interior.ColorIndex = Ar(i - 1) '¨Ì½d³ò¶Ç¦^ªºÃC¦â
- Next
- Next
- End Sub
½Æ»s¥N½X |
|