- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¦^´_ 25# s7659109
(³o¤@¨â¤Ñ¦Ñ¬O¦^¿ù¥DÃD, ³s¶K¨â¦¸³£¶K¿ù¦a¤è, ¯u©_©Ç!),
¸gã¤j¦A¤T«ü¥¿«á, Á`ºâ§¹¦¨¤F!!
¸Õ¸Õ¬Ý:- Option Explicit
- Public inAllNum As Integer
- Public inNowNum As Integer
- Function BigRng() As Range
- Dim rL As String, I As Integer
- rL = Split([B5].End(xlToRight).Address, "$")(1)
- Set BigRng = Range("B5:" & rL & [B5].End(xlDown).Row & "")
- BigRng.Select
- Selection.Interior.ColorIndex = xlNone '²M°£©³¦â
- For I = 1 To 4
- Selection.Borders(I).LineStyle = xlNone '²M°£®æ½u
- Next
- ' For I = 7 To 10
- ' Selection.Borders(I).LineStyle = xlNone
- ' Next
- End Function
- Function SmallRng() As Range
- Dim rL As String, I As Integer
- rL = Split([B5].End(xlToRight).Address, "$")(1)
- Set SmallRng = Range("B" & [D2] & ":" & rL & [D3] & "") '³]©w±Ò©l¦C»P²×¤î¦C¤§¬°·j´M½d³ò
- End Function
- Function inputRng() As Range
- Dim rL As String, cNumAr
- Dim str1 As String, I As Integer
- cNumAr = Array(4, 6, 7, 8, 15, 17, 19, 20, 22, 24, 33, 35, 36, 37, 39, 40) '¬D¿ï²L¦â¨t
- Rows("1:3").Interior.ColorIndex = xlNone '²M°£¿é¤J°Ï©³¦â
- rL = Split([G1].End(xlToRight).Address, "$")(1)
- Range("G3:" & rL & "3") = "" '²M°£²Îpµ²ªG
- inAllNum = [G1].End(xlToRight).Column - 6 '¿é¤J°Ï¦@¦³´X®æ
- inNowNum = [G2].End(xlToRight).Column - 6 '¥Ø«e¤w¸g¿é¤J´X®æ
- [F1].FormulaR1C1 = "=SUMPRODUCT((R[1]C[1]:R[1]C[" & inAllNum & "]<>"""")/COUNTIF(R[1]C[1]:R[1]C[" & inAllNum & "],R[1]C[1]:R[1]C[" & inAllNum & "]&""""))"
- For I = 7 To 6 + inAllNum
- Cells(1, I).Resize(3).Interior.ColorIndex = cNumAr(I - 7)
- Next
- str1 = "G2:" & rL & "2"
- Set inputRng = Range(str1)
- End Function
- Sub ¶}©l²Îp()
- Dim inRng As Range, bRng As Range, sRng As Range
- Dim Rng As Range, Cel As Range
- Dim FstAddr As String
- Dim ndx As Integer, cNum As Integer
- Set bRng = BigRng
- Set sRng = SmallRng
- Set inRng = inputRng
-
- '¥ý·j´M¤j½d³ò
- For Each Cel In inRng
- If Cel = "" Then Exit For
- On Error Resume Next '©¿²¤¿ù»~Ä~Äò°õ¦æ VBA ¥N½X, ÁקK¥X²{¿ù»~®ø®§
- Set Cel = bRng.Find(What:=Cel, LookAt:=xlWhole) '¦b¤j½d³ò¤¤·j´M
- If Cel Is Nothing Then
- MsgBox "ª`·N:" & Chr(10) & "¸ê®Æ¿é¤J¿ù»~!!" & Chr(10) & "½Ð×¥¿!!", vbCritical
- Exit Sub
- End If
- Next
- '¦A·j´M¤p½d³ò
- For Each Cel In inRng
- Cel.Activate
- cNum = Cel.Interior.ColorIndex
- ndx = 0
- On Error Resume Next '©¿²¤¿ù»~Ä~Äò°õ¦æ VBA ¥N½X, ÁקK¥X²{¿ù»~®ø®§
- sRng.Find(What:=Cel, LookAt:=xlWhole).Activate
- If ActiveCell.Address = Cel.Address Then GoTo next1 '¦pªGì¦a½ñ´N¬O§ä¤£¨ì
- '¦pªG¦³§ä¨ì, ... ...
- ActiveCell.Interior.ColorIndex = cNum
- FstAddr = ActiveCell.Address
- Do
- ndx = ndx + 1
- sRng.FindNext(After:=ActiveCell).Activate 'Ä~Äò§ä¤U¤@Ó
- ActiveCell.Interior.ColorIndex = cNum
- Loop Until FstAddr = ActiveCell.Address 'ª½¨ì¦^¨ì²Ä¤@¦¸§ä¨ìªºÀx¦s®æ
- next1:
- Cel.Offset(1, 0) = ndx '²Îpȼg¤J ndx, ´«¤U¤@®æ
- Next
- End Sub
- Private Sub CommandButton1_Click()
- Dim Rng As Range, inRng As Range, bRng As Range, sRng As Range
- Dim I As Integer
- Set bRng = BigRng
- Set sRng = SmallRng
- Set inRng = inputRng
-
- If Val([D2]) < 5 Then
- MsgBox "ª`·N:" & Chr(10) & "§PÂ_±ø¥óªº±Ò©l¦CªºÈ ¤£¥i¤p©ó 5!!", vbCritical
- Exit Sub
- End If
- If Val([D3]) > [B5].End(xlDown).Row Then
- MsgBox "ª`·N:" & Chr(10) & "§PÂ_±ø¥óªº²×¤î¦CªºÈ ¤£¥i¤j©ó" & [B5].End(xlDown).Row & "!!", vbCritical
- Exit Sub
- End If
- If Val([D2]) > Val([D3]) Then '¦pªG ±Ò©l¦CªºÈ ¤j©ó ²×¤î¦CªºÈ
- MsgBox "ª`·N:" & Chr(10) & "±Ò©l¦CªºÈ ¤£¥i¥H¤j©ó ²×¤î¦CªºÈ!!", vbCritical
- Exit Sub
- End If
- If inNowNum < inAllNum Then
- MsgBox "ª`·N:" & Chr(10) & "¿é¤J°Ï©|¥¼¶ñ满«e," & Chr(10) & "½Ð¤Å«ö¡i¶}©l²Îp¡j!!", vbCritical
- Exit Sub '¦pªG¿é¤J°Ï¥¼º¡®æ, Â÷¶}
- End If
- If Val([F1]) < inNowNum Then
- MsgBox "ª`·N:" & Chr(10) & "¿é¤J°ÏªºÈ«ÂÐ," & Chr(10) & "½Ð×¥¿!!", vbCritical
- Exit Sub
- End If
- ¶}©l²Îp
- SmallRng.Select
- For I = 7 To 10
- With Selection.Borders(I) 'µe®æ½u
- .LineStyle = xlContinuous
- .Weight = xlMedium
- End With
- Next
- End Sub
½Æ»s¥N½X
Åã¥Ü¿é¤Jȶñº¡ÃC¦â2.rar (28.32 KB)
|
|