ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¬d¸ß²£«~¼Æ¶q

¦^´_ 20# GBKEE


  DEAR ¤j¤j:

¦Û°Ê½s½X §Ú§ä¨ì

¥i¬O ¬d¸ß ©M §R°£¾ã¦C ¤£·|°µ

¦pªþ¥ó

ÁÂÁ«ü±Ð

®w¦s¿é¤J­pºâ0911.rar (15.69 KB)

owen

TOP

¦^´_ 21# owen9399
  1. Option Explicit
  2. Option Base 1
  3. Dim Ar(), Sh As Worksheet
  4. Private Sub CommandButton1_Click()
  5.     Dim Nrow As Integer
  6.     If ¸ê®ÆÀˬd = True Then Exit Sub
  7.     Nrow = ¸ê®Æ¼Æ
  8.     If MsgBox("½T©w·s¼W²Ä " & Nrow & " ¸ê®Æ", vbYesNo) = vbNo Then Exit Sub
  9.    
  10.     Ar(1).Value = Nrow
  11.     With Sh.Range("a" & Ar(1) + 1)
  12.         .Resize(, UBound(Ar)) = Ar
  13.         .Resize(, UBound(Ar)) = .Resize(, UBound(Ar)).Value
  14.        '.Cells(1, "i") = "=sum(r2c4:rc4)+sum(r2c5:rc5)-(sum(r2c7:rc7)+sum(r2c8:rc8))"  '®w¦s®tÃB
  15.         '(¥x¥_¥X³f1 + ¥x¥_¥X³f2)  -  ·~°È­ûªº (¶i³f¼Æ¶q1+¶i³f¼Æ¶q2)   = ®w¦s®tÃB   ** ©Ç©Çªº **

  16.         '***************************************************************************************
  17.         ' ®w¦s®tÃB : À³¸Ó¬O·~°È­ûªº (¶i³f¼Æ¶q1+¶i³f¼Æ¶q2) - (¥x¥_¥X³f1 + ¥x¥_¥X³f2)
  18.         .Cells(1, "i") = "=sum(r2c7:rc7)+sum(r2c8:rc8)-(sum(r2c4:rc4)+sum(r2c5:rc5))"  '®w¦s®tÃB
  19.         '***************************************************************************************
  20.         .Cells(1, "i").Value = .Cells(1, "i")     'Âà¤Æ¤½¦¡ = ­pºâ«áªº¼Æ­È
  21.     End With
  22. End Sub
  23. Private Sub CommandButton2_Click()
  24.     Dim I As Integer
  25.     For I = 1 To UBound(Ar)
  26.       Ar(I).Value = ""
  27.     Next
  28. End Sub
  29. Private Sub CommandButton3_Click()
  30.     Dim I As Integer, Rng As Range
  31.     With Sh
  32.         .AutoFilterMode = False
  33.         For I = 1 To UBound(Ar)
  34.             If Ar(I) <> "" Then .Range("A1").AutoFilter I, Ar(I)
  35.         Next
  36.         .Range("A:i").SpecialCells(xlCellTypeVisible).Copy .Range("AA1")
  37.         .AutoFilterMode = False
  38.         Set Rng = .Range("AA1").CurrentRegion.Offset(1)
  39.     End With
  40.    ListBox1.RowSource = Rng.Address
  41. End Sub
  42. Private Sub CommandButton4_Click()
  43.     Dim s, E As Range, I As Integer
  44.     With ListBox1
  45.         If .ListIndex = -1 Then MsgBox "¨S¦³¿ï¾Ü!!": Exit Sub
  46.         s = Application.Index(Application.Transpose(Application.Transpose(.List)), IIf(.ListCount = 1, 0, 1))
  47.         If Join(s, "") = "" Then MsgBox "¨S¦³¸ê®Æ!!": Exit Sub
  48.         s = Application.Index(Application.Transpose(Application.Transpose(.List)), IIf(.ListCount = 1, 0, .ListIndex + 1))
  49.     End With
  50.     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 ]
  51.     With Sh
  52.         For Each E In .Range("A1", .Range("A1").End(xlDown)).Resize(, 9).Rows '¾ã¦C:[ ¦Û°Ê½s¸¹......®w¦s®tÃB ]
  53.             If s = Join(Application.Transpose(Application.Transpose(E)), ",") Then
  54.                 If MsgBox(Join(Application.Transpose(Application.Transpose(E.Value)), ","), vbYesNo, "§R°£¦C") = vbYes Then
  55.                     ³B¸Ì§R°£¾ã¦C E
  56.                 End If
  57.             End If
  58.         Next
  59.     End With
  60.     CommandButton3_Click   '­«·s¬d¸ß
  61. End Sub
  62. Private Sub CommandButton5_Click()
  63.     End
  64. End Sub
  65. Private Sub UserForm_Initialize()
  66.     Ar = Array(TextBox1, ComboBox1, ComboBox2, TextBox2, TextBox3, ComboBox3, TextBox4, TextBox5)
  67.     Set Sh = Worksheets("sheet1")
  68.     With Sh
  69.         ComboBox1.RowSource = Sh.Range("L2:L5").Address
  70.         ComboBox2.RowSource = Sh.Range("N2:N6").Address
  71.         ComboBox3.RowSource = Sh.Range("M2:M4").Address
  72.     End With
  73.     With ListBox1
  74.         .ColumnHeads = True
  75.         .ColumnCount = 9
  76.     End With
  77. End Sub
  78. Private Sub ³B¸Ì§R°£¾ã¦C(Rng As Range)
  79.     Dim I As Integer
  80.     Rng.Delete xlUp
  81.     I = ¸ê®Æ¼Æ
  82.     If I > 1 Then
  83.         With Sh
  84.             With .Range("a2:a" & I)
  85.             .Value = "=row()-1"
  86.             .Value = .Value
  87.         End With
  88.         With .Range("i2:i" & I)
  89.             .Value = "=sum(r2c7:rc7)+sum(r2c8:rc8)-(sum(r2c4:rc4)+sum(r2c5:rc5))"  '®w¦s®tÃB
  90.             .Value = .Value
  91.         End With
  92.      End With
  93.     End If
  94.      
  95. End Sub
  96. Private Function ¸ê®Æ¼Æ() As Integer
  97.     ¸ê®Æ¼Æ = Application.CountA(Sh.Range("A:A"))     '¦Û°Ê½s¸¹
  98. End Function
  99. Private Function ¸ê®ÆÀˬd() As Boolean
  100.     Dim s As String, E As Range, I As Integer, ii
  101.     With Sh
  102.     For I = 2 To UBound(Ar)
  103.         ii = 10 - Len(Sh.Cells(1, I))
  104.         If I = 2 Or I = 3 Or I = 6 Then
  105.             If Ar(I).ListIndex = -1 Then s = s & IIf(s = "", "", vbLf) & Sh.Cells(1, I) + Space(ii) & vbTab & Ar(I)
  106.         Else
  107.             If Not IsNumeric(Ar(I)) And Ar(I) <> "" Then s = s & IIf(s = "", "", vbLf) & Sh.Cells(1, I) + Space(ii) & vbTab & Ar(I)
  108.         
  109.         End If
  110.     Next
  111.     If s <> "" Then
  112.     ¸ê®ÆÀˬd = True: MsgBox s, , "¸ê®Æ¦³»~!!": Exit Function
  113.     ElseIf s = "" And Ar(4) & Ar(5) & Ar(7) & Ar(8) = "" Then
  114.         ¸ê®ÆÀˬd = True: MsgBox "¥X³f ¶i³f ¨S¦³¼Æ¶q", , "¸ê®Æ¦³»~!!": Exit Function
  115.     End If
  116.     s = "," & Join(Ar, "")
  117.     s = Replace(s, "," & Ar(1), "")  'S:  µ²¦X±±¨î¶µªº¦r¦ê [ §Ç¸¹¤½¥q²£«~¦WºÙ¥x¥_¥X³f1¥x¥_¥X³f2·~°È­û¶i³f¼Æ¶q1¶i³f¼Æ¶q2 ]
  118.         For Each E In .Range("B1", .Range("B1").End(xlDown)).Resize(, 7).Rows
  119.             If s = Join(Application.Transpose(Application.Transpose(E.Value)), "") Then
  120.                 MsgBox Replace(Join(Ar, ","), Ar(1) & ",", "") & vbLf & "¤w¦s¦b¬° ²Ä" & E.Row - 1 & " µ§ ¸ê®Æ¤£¥i·s¼W"
  121.                 ¸ê®ÆÀˬd = True
  122.                 Exit Function
  123.             End If
  124.         Next
  125.     End With
  126. End Function
½Æ»s¥N½X
¦p¹Ï ªí³æ¤¤·s¥[¤@ ListBox1

·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 22# GBKEE


    Dear ¤j¤j:

   ¯uªº«Ü·PÁ§A

    §Úªº®w¦s®tÃB ¬O«ü ¨C¤@µ§ ªº®t­È
   ¨Ã«D ¥þ³¡µ§¼Æ ²Ö­p ªº®tÃB
  
   ¦p¦ó­×¥¿

   ÁÂÁÂ

®w¦s¿é¤J­pºâ0911(¤w¿é¤Jµ{¦¡).rar (23 KB)

owen

TOP

¦^´_ 23# owen9399
  1. Private Sub CommandButton1_Click()
  2.   Dim Nrow As Integer
  3.     If ¸ê®ÆÀˬd = True Then Exit Sub
  4.     Nrow = ¸ê®Æ¼Æ
  5.     If MsgBox("½T©w·s¼W²Ä " & Nrow & " ¸ê®Æ", vbYesNo) = vbNo Then Exit Sub
  6.     ar(1).Value = Nrow
  7.     With Sh.Range("a" & ar(1) + 1)
  8.         .Resize(, UBound(ar)) = ar
  9.         .Resize(, UBound(ar)) = .Resize(, UBound(ar)).Value
  10.         '.Cells(1, "i") = "=sum(r2c7:rc7)+sum(r2c8:rc8)-(sum(r2c4:rc4)+sum(r2c5:rc5))"  '®w¦s®tÃB
  11.         '.Cells(1, "i") = "=sum(r2c4:rc4)+sum(r2c5:rc5)-(sum(r2c7:rc7)+sum(r2c8:rc8))"  '®w¦s®tÃB
  12.         .Cells(1, "i") = "=(rc4+rc5)-(rc7+rc8)"  '®w¦s®tÃB    ¤½¦¡
  13.       '  .Cells(1, "i").Value = .Cells(1, "i")     'Âà¤Æ¤½¦¡ = ­pºâ«áªº¼Æ­È
  14.     End With
  15. End Sub
½Æ»s¥N½X
  1. Private Sub ³B¸Ì§R°£¾ã¦C(Rng As Range)
  2.     Dim I As Integer
  3.     Rng.Delete xlUp
  4.     I = ¸ê®Æ¼Æ
  5.     If I > 1 Then
  6.         With Sh
  7.             With .Range("a2:a" & I)
  8.                 .Value = "=row()-1"
  9.                 .Value = .Value
  10.             End With
  11.             With .Range("i2:i" & I)
  12.                 '.Value = "=sum(r2c7:rc7)+sum(r2c8:rc8)-(sum(r2c4:rc4)+sum(r2c5:rc5))"  '®w¦s®tÃB
  13.                 .Value = "=(rc4+rc5)-(rc7+rc8)" '®w¦s®tÃB  ¤½¦¡
  14.               '  .Value = .Value                      ''®w¦s®tÃB  ¼Æ­È

  15.             End With
  16.         End With
  17.     End If
  18. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 24# GBKEE


    Dear ¤j¤j:

   ÁÂÁÂ

  µ{¦¡ok «D±`·P®¦
owen

TOP

¥»©«³Ì«á¥Ñ owen9399 ©ó 2013-9-11 17:59 ½s¿è

¦^´_ 24# GBKEE


    Dear ¤j¤j:

§Ú­n ¦A ©µ¦ù ·sªº¤u§@ªí ¦p
1.¨q¥X ¿é¤J¼Æ­È ªºªí³æ
¦pªG ¥i¥H ¾ã¦X ¥Î sheet1ªº ¤U©Ô¦¡ ´N¤ñ¸û¦n
sheet1 ªº ³¡¥÷¼Æ­È ·|©M ¿é¤J¼Æ­È µ²¦X ¦b¤À¨ì 3¦ìÁ`²M³æ
¥Ø«e
¿é¤J  ¤£·|§ï
§R°£¾ã¦C   ¤£·|§ï

2.¨ì®É«á­n¾ã¦X ¤À§O ±a¨ì 3¦ì·~°È­ûÁ`²M³æ

ªþ¥ó


ÁÂÁ«ü¾É

®w¦s¿é¤J­pºâ0911(·s¼W¶µ¥Ø)1.rar (31.76 KB)

owen

TOP

¦^´_ 26# owen9399
¨S»¡©úsheet1³¡¥÷¼Æ­È,¿é¤J¼Æ­ÈªºÃö«Y, ¦p¦óµ²¦X¨ì3¦ìÁ`²M³æ
°tÃB,µ§¼Æ »P sheet1¼Æ­ÈªºÃö³s¦p¦ó??
¿é¤J¼Æ­Èªºªí³æ,·s¼Wµ{¦¡¨S§Ë¦n
  1. '*** UserForm2 ªí³æ¼Ò²Õ *********
  2. Option Base 1
  3. Dim ar(), Sh(1 To 2) As Worksheet
  4. Private Sub UserForm_Initialize()
  5.      ar = Array(TextBox1, ComboBox1, TextBox2, TextBox3, TextBox4, TextBox5, TextBox6, ComboBox2)     '³o¸Ì¦³­×§ï±±¨î¶µ,¨Æ¥¿½Tªº
  6.      Set Sh(1) = Worksheets("Sheet1")
  7.      Set Sh(2) = Worksheets("¿é¤J¼Æ­È")
  8.        With Sh(2)
  9.         ComboBox1.RowSource = Sh(1).Range("L2:L5").Address  ' ¾ã¦X¥Îsheet1ªº¤U©Ô¦¡
  10.         ComboBox2.RowSource = Sh(1).Range("M2:M4").Address
  11.      End With
  12.      With ListBox1
  13.         .ColumnHeads = True
  14.         .ColumnCount = 8
  15.      End With
  16. End Sub
  17. Private Function ¸ê®ÆÀˬd() As Boolean
  18.         Dim s As String, E As Range, I As Integer, ii
  19.         With Sh
  20.         For I = 2 To UBound(ar)
  21.             ii = 10 - Len(Sh.Cells(1, I))
  22.             If I = 2 Or I = 3 Or I = 6 Then   'I= ??  ComboBox ¤Î ListBox ¤~¦³.ListIndexªºÄÝ©Ê
  23.             '*** ³o¸Ì¨S§ï:TextBox1 ¨S¦³.ListIndexªºÄÝ©Ê  ****
  24.                If ar(I).ListIndex = -1 Then s = s & IIf(s = "", "", vbLf) & Sh.Cells(1, I) + Space(ii) & vbTab & ar(I)
  25.                
  26.            Else
  27.                 If Not IsNumeric(ar(I)) And ar(I) <> "" Then s = s & IIf(s = "", "", vbLf) & Sh.Cells(1, I) + Space(ii) & vbTab & ar(I)
  28.                 '*** ³o¸Ì¤]­n§ï  ***********
  29.             End If
  30.             Next
  31.         If s <> "" Then
  32.         ¸ê®ÆÀˬd = True: MsgBox s, , "¸ê®Æ¦³»~!!": Exit Function
  33.         ElseIf s = "" And ar(4) & ar(5) & ar(7) & ar(8) = "" Then  '*** ³o¸Ì¤]­n§ï  ***********
  34.             ¸ê®ÆÀˬd = True: MsgBox "¥X³f ¶i³f ¨S¦³¼Æ¶q", , "¸ê®Æ¦³»~!!": Exit Function
  35.        End If
  36.         s = "," & Join(ar, "")
  37.         s = Replace(s, "," & ar(1), "")  'S:  µ²¦X±±¨î¶µªº¦r¦ê [ ¦Û°Ê½s¸¹§Ç¸¹¤½¥q°tÃBµ§¼Æ¼Æ­ÈÀ³¥I¤w¥I(¶i³f¼Æ¶q1+¶i³f¼Æ¶q2)·~°È­û ]
  38.             For Each E In .Range("B1", .Range("B1").End(xlDown)).Resize(, 7).Rows
  39.                 If s = Join(Application.Transpose(Application.Transpose(E.Value)), "") Then
  40.                     MsgBox Replace(Join(ar, ","), ar(1) & ",", "") & vbLf & "¤w¦s¦b¬° ²Ä" & E.Row - 1 & " µ§ ¸ê®Æ¤£¥i·s¼W"
  41.                     ¸ê®ÆÀˬd = True
  42.                     Exit Function
  43.                 End If
  44.             Next
  45.         End With
  46.         
  47.   End Function
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 27# GBKEE


    Dear ¤j¤j:
   §Ú¦³­×§ï
   ¥i¬O §R°£¾ã¦C µLªk¥Î

   ¤£ª¾¦p¦ó§ï

   ÁÂÁÂ

®w¦s¿é¤J­pºâ0912(·s¼W¶µ¥Ø)2.rar (31.9 KB)

owen

TOP

¦^´_ 28# owen9399
  1. Private Sub CommandButton3_Click() '¬d¸ß
  2.     Dim I As Integer, Rng As Range
  3.      With Sh(2)
  4.          .AutoFilterMode = False
  5.          For I = 1 To UBound(ar)
  6.             If ar(I) <> "" Then .Range("A1").AutoFilter I, ar(I)
  7.          Next
  8.         '.Range("A:i").SpecialCells(xlCellTypeVisible).Copy .Range("AA1") ->'Sh(2)ªº AA1->AIøó
  9.          '*******   .ColumnCount = 8    'ListBox1³]©w8øó     ©Ò¥H§ï¦¨¦p¤U********
  10.         .Range("A:H").SpecialCells(xlCellTypeVisible).Copy .Range("AA1")
  11.          .AutoFilterMode = False
  12.          Set Rng = .Range("AA1").CurrentRegion.Offset(1)   'Sh(2)ªº AA1->AH :AIø󪺸ê®Æ,*****AIøó¶·¥ý§R±¼(¤â°Ê)*****
  13.      End With
  14.   ListBox1.RowSource = Rng.Address
  15. End Sub
  16. Private Sub CommandButton4_Click() '§R°£¾ã¦C
  17.     Dim s, E As Range, I As Integer
  18.     With ListBox1
  19.         If .ListIndex = -1 Then MsgBox "¨S¦³¿ï¾Ü!!": Exit Sub
  20.         s = Application.Index(Application.Transpose(Application.Transpose(.List)), IIf(.ListCount = 1, 0, 1))
  21.         If Join(s, "") = "" Then MsgBox "¨S¦³¸ê®Æ!!": Exit Sub
  22.         s = Application.Index(Application.Transpose(Application.Transpose(.List)), IIf(.ListCount = 1, 0, .ListIndex + 1))
  23.         'S= ListIndexªº¿ï¾Ü.ListIndex ¨º¤@¦Cªº¸ê®Æ,·|¤ñ Resize(, 8)¦h¤@øó.
  24.         '·í
  25.         '->.Range("A:i").SpecialCells(xlCellTypeVisible).Copy .Range("AA1") ->'Sh(2)ªº AA1->AIøó
  26.         '-> For Each E In .Range("A1", .Range("A1").End(xlDown)).Resize(, 8).Rows '¾ã¦C:[ ¦Û°Ê½s¸¹......·~°È­û ]
  27.     End With
  28.     s = Join(s, ",")   'S:  µ²¦X±±¨î¶µªº¦r¦ê [ ¦Û°Ê½s¸¹§Ç¸¹¤½¥q°tÃBµ§¼Æ¼Æ­ÈÀ³¥I¤w¥I(¶i³f¼Æ¶q1+¶i³f¼Æ¶q2)·~°È­û ]
  29.     With Sh(2)
  30.          For Each E In .Range("A1", .Range("A1").End(xlDown)).Resize(, 8).Rows '¾ã¦C:[ ¦Û°Ê½s¸¹......·~°È­û ]
  31.             Debug.Print s
  32.             Debug.Print Join(Application.Transpose(Application.Transpose(E)), ",")
  33.             If s = Join(Application.Transpose(Application.Transpose(E)), ",") Then
  34.                
  35.                 If MsgBox(Join(Application.Transpose(Application.Transpose(E.Value)), ","), vbYesNo, "§R°£¦C") = vbYes Then
  36.                      ³B¸Ì§R°£¾ã¦C E
  37.                 End If
  38.             End If
  39.         Next
  40.     End With
  41.     CommandButton3_Click   '­«·s¬d¸ß
  42. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 29# GBKEE


    DEAR ¤j¤j:

   §Ú¸Õ¤£¥X¨Ó §R°£¾ã¦C ªº°ÝÃD

   µLªk°õ¦æ
owen

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C
ªð¦^¦Cªí ¤W¤@¥DÃD