- ©«¤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 
 
           
 | 
                
¦^´_ 21# owen9399 - Option Explicit
 
 - Option Base 1
 
 - Dim Ar(), Sh As Worksheet
 
 - Private Sub CommandButton1_Click()
 
 -     Dim Nrow As Integer
 
 -     If ¸ê®ÆÀˬd = True Then Exit Sub
 
 -     Nrow = ¸ê®Æ¼Æ
 
 -     If MsgBox("½T©w·s¼W²Ä " & Nrow & " ¸ê®Æ", vbYesNo) = vbNo Then Exit Sub
 
 -     
 
 -     Ar(1).Value = Nrow
 
 -     With Sh.Range("a" & Ar(1) + 1)
 
 -         .Resize(, UBound(Ar)) = Ar
 
 -         .Resize(, UBound(Ar)) = .Resize(, UBound(Ar)).Value
 
 -        '.Cells(1, "i") = "=sum(r2c4:rc4)+sum(r2c5:rc5)-(sum(r2c7:rc7)+sum(r2c8:rc8))"  '®w¦s®tÃB
 
 -         '(¥x¥_¥X³f1 + ¥x¥_¥X³f2)  -  ·~°Èûªº (¶i³f¼Æ¶q1+¶i³f¼Æ¶q2)   = ®w¦s®tÃB   ** ©Ç©Çªº **
 
  
-         '***************************************************************************************
 
 -         ' ®w¦s®tÃB : À³¸Ó¬O·~°Èûªº (¶i³f¼Æ¶q1+¶i³f¼Æ¶q2) - (¥x¥_¥X³f1 + ¥x¥_¥X³f2)
 
 -         .Cells(1, "i") = "=sum(r2c7:rc7)+sum(r2c8:rc8)-(sum(r2c4:rc4)+sum(r2c5:rc5))"  '®w¦s®tÃB
 
 -         '***************************************************************************************
 
 -         .Cells(1, "i").Value = .Cells(1, "i")     'Âà¤Æ¤½¦¡ = pºâ«áªº¼ÆÈ
 
 -     End With
 
 - End Sub
 
 - Private Sub CommandButton2_Click()
 
 -     Dim I As Integer
 
 -     For I = 1 To UBound(Ar)
 
 -       Ar(I).Value = ""
 
 -     Next
 
 - End Sub
 
 - Private Sub CommandButton3_Click()
 
 -     Dim I As Integer, Rng As Range
 
 -     With Sh
 
 -         .AutoFilterMode = False
 
 -         For I = 1 To UBound(Ar)
 
 -             If Ar(I) <> "" Then .Range("A1").AutoFilter I, Ar(I)
 
 -         Next
 
 -         .Range("A:i").SpecialCells(xlCellTypeVisible).Copy .Range("AA1")
 
 -         .AutoFilterMode = False
 
 -         Set Rng = .Range("AA1").CurrentRegion.Offset(1)
 
 -     End With
 
 -    ListBox1.RowSource = Rng.Address
 
 - End Sub
 
 - Private Sub CommandButton4_Click()
 
 -     Dim s, E As Range, I As Integer
 
 -     With ListBox1
 
 -         If .ListIndex = -1 Then MsgBox "¨S¦³¿ï¾Ü!!": Exit Sub
 
 -         s = Application.Index(Application.Transpose(Application.Transpose(.List)), IIf(.ListCount = 1, 0, 1))
 
 -         If Join(s, "") = "" Then MsgBox "¨S¦³¸ê®Æ!!": Exit Sub
 
 -         s = Application.Index(Application.Transpose(Application.Transpose(.List)), IIf(.ListCount = 1, 0, .ListIndex + 1))
 
 -     End With
 
 -     s = Join(s, ",")   'S:  µ²¦X±±¨î¶µªº¦r¦ê [ ¦Û°Ê½s¸¹§Ç¸¹¤½¥q²£«~¦WºÙ¥x¥_¥X³f1¥x¥_¥X³f2·~°Èû¶i³f¼Æ¶q1¶i³f¼Æ¶q2®w¦s®tÃB ]
 
 -     With Sh
 
 -         For Each E In .Range("A1", .Range("A1").End(xlDown)).Resize(, 9).Rows '¾ã¦C:[ ¦Û°Ê½s¸¹......®w¦s®tÃB ]
 
 -             If s = Join(Application.Transpose(Application.Transpose(E)), ",") Then
 
 -                 If MsgBox(Join(Application.Transpose(Application.Transpose(E.Value)), ","), vbYesNo, "§R°£¦C") = vbYes Then
 
 -                     ³B¸Ì§R°£¾ã¦C E
 
 -                 End If
 
 -             End If
 
 -         Next
 
 -     End With
 
 -     CommandButton3_Click   '«·s¬d¸ß
 
 - End Sub
 
 - Private Sub CommandButton5_Click()
 
 -     End
 
 - End Sub
 
 - Private Sub UserForm_Initialize()
 
 -     Ar = Array(TextBox1, ComboBox1, ComboBox2, TextBox2, TextBox3, ComboBox3, TextBox4, TextBox5)
 
 -     Set Sh = Worksheets("sheet1")
 
 -     With Sh
 
 -         ComboBox1.RowSource = Sh.Range("L2:L5").Address
 
 -         ComboBox2.RowSource = Sh.Range("N2:N6").Address
 
 -         ComboBox3.RowSource = Sh.Range("M2:M4").Address
 
 -     End With
 
 -     With ListBox1
 
 -         .ColumnHeads = True
 
 -         .ColumnCount = 9
 
 -     End With
 
 - End Sub
 
 - Private Sub ³B¸Ì§R°£¾ã¦C(Rng As Range)
 
 -     Dim I As Integer
 
 -     Rng.Delete xlUp
 
 -     I = ¸ê®Æ¼Æ
 
 -     If I > 1 Then
 
 -         With Sh
 
 -             With .Range("a2:a" & I)
 
 -             .Value = "=row()-1"
 
 -             .Value = .Value
 
 -         End With
 
 -         With .Range("i2:i" & I)
 
 -             .Value = "=sum(r2c7:rc7)+sum(r2c8:rc8)-(sum(r2c4:rc4)+sum(r2c5:rc5))"  '®w¦s®tÃB
 
 -             .Value = .Value
 
 -         End With
 
 -      End With
 
 -     End If
 
 -      
 
 - End Sub
 
 - Private Function ¸ê®Æ¼Æ() As Integer
 
 -     ¸ê®Æ¼Æ = Application.CountA(Sh.Range("A:A"))     '¦Û°Ê½s¸¹
 
 - End Function
 
 - Private Function ¸ê®ÆÀˬd() As Boolean
 
 -     Dim s As String, E As Range, I As Integer, ii
 
 -     With Sh
 
 -     For I = 2 To UBound(Ar)
 
 -         ii = 10 - Len(Sh.Cells(1, I))
 
 -         If I = 2 Or I = 3 Or I = 6 Then
 
 -             If Ar(I).ListIndex = -1 Then s = s & IIf(s = "", "", vbLf) & Sh.Cells(1, I) + Space(ii) & vbTab & Ar(I)
 
 -         Else
 
 -             If Not IsNumeric(Ar(I)) And Ar(I) <> "" Then s = s & IIf(s = "", "", vbLf) & Sh.Cells(1, I) + Space(ii) & vbTab & Ar(I)
 
 -         
 
 -         End If
 
 -     Next
 
 -     If s <> "" Then
 
 -     ¸ê®ÆÀˬd = True: MsgBox s, , "¸ê®Æ¦³»~!!": Exit Function
 
 -     ElseIf s = "" And Ar(4) & Ar(5) & Ar(7) & Ar(8) = "" Then
 
 -         ¸ê®ÆÀˬd = True: MsgBox "¥X³f ¶i³f ¨S¦³¼Æ¶q", , "¸ê®Æ¦³»~!!": Exit Function
 
 -     End If
 
 -     s = "," & Join(Ar, "")
 
 -     s = Replace(s, "," & Ar(1), "")  'S:  µ²¦X±±¨î¶µªº¦r¦ê [ §Ç¸¹¤½¥q²£«~¦WºÙ¥x¥_¥X³f1¥x¥_¥X³f2·~°Èû¶i³f¼Æ¶q1¶i³f¼Æ¶q2 ]
 
 -         For Each E In .Range("B1", .Range("B1").End(xlDown)).Resize(, 7).Rows
 
 -             If s = Join(Application.Transpose(Application.Transpose(E.Value)), "") Then
 
 -                 MsgBox Replace(Join(Ar, ","), Ar(1) & ",", "") & vbLf & "¤w¦s¦b¬° ²Ä" & E.Row - 1 & " µ§ ¸ê®Æ¤£¥i·s¼W"
 
 -                 ¸ê®ÆÀˬd = True
 
 -                 Exit Function
 
 -             End If
 
 -         Next
 
 -     End With
 
 - End Function
 
  ½Æ»s¥N½X ¦p¹Ï ªí³æ¤¤·s¥[¤@ ListBox1  
 
 
 
 |   
 
 
 
 |