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

¤U©Ô¦¡­n¦p¦ó¿ï¾Ü«á·|¦Û°Ê±a¥X¨ä¥Lªí³æ°T®§

¦^´_ 1# Jared
ªþÀÉ»¡©ú§Aªº°ÝÃD.­n¸ÑµªªÌ,¦n¸Ñµª¨Ç!!

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-3-7 14:56 ½s¿è

¦^´_ 3# Jared
¸Õ¸Õ¬Ý³o¬O§_¦p§A©Ò»Ý
  1. 'ListIndex = -1: ©Ò¿ïªº¤£¦b List²M³æ¤º
  2. Private Sub ComboBox1_Change()
  3.     If ComboBox1.ListIndex > -1 Then
  4.         À\ÂI
  5.     Else
  6.         ComboBox2 = ""
  7.     End If
  8. End Sub
  9. Private Sub ComboBox2_Change()
  10.     TextBox1 = ""
  11.     If ComboBox2.ListIndex > -1 Then TextBox1 = ComboBox2.List(ComboBox2.ListIndex, 1)
  12. End Sub
  13. Private Sub CommandButton1_Click()
  14.     Dim A
  15.     If ComboBox1.ListIndex = -1 Or ComboBox2.ListIndex = -1 Then MsgBox "À\ÂI¤º®e »Ý»ô¥þ !!": Exit Sub
  16.     With Sheet10
  17.         .Cells(.Rows.Count, 1).End(xlUp).Offset(1).Resize(, 3).Value = Array(ComboBox1, ComboBox2, TextBox1)
  18.     End With
  19. End Sub
  20. Private Sub CommandButton2_Click()
  21.     test4.Hide
  22. End Sub
  23. Private Sub CommandButton3_Click()
  24.     Me.ComboBox1 = ""
  25.     Me.ComboBox2 = ""
  26.     Me.TextBox1 = ""
  27. End Sub
  28. Private Sub UserForm_Initialize()
  29.     ComboBox1.List = Array("¤@¸¹À\", "¤G¸¹À\", "¤T¸¹À\")
  30. End Sub
  31. Private Sub À\ÂI()
  32.     With ComboBox2
  33.         .Clear
  34.         Select Case ComboBox1.ListIndex
  35.             Case 0               '¤@¸¹À\
  36.                 .AddItem "º~³ù¡BÁ¦±ø¡B¥i¼Ö"
  37.                 .List(.ListCount - 1, 1) = 50           'ComboBox2ªº²Ä2Äæ  ¨SÅã¥Ü¥X¨Ó
  38.                 .AddItem "º~³ù¡BÁ¦»æ¡B¥i¼Ö"
  39.                 .List(.ListCount - 1, 1) = 49
  40.                 .AddItem "º~³ù¡BÁ¦»æ¡B¬õ¯ù"
  41.                 .List(.ListCount - 1, 1) = 48
  42.             Case 1             '¤G¸¹À\
  43.                 .AddItem "Âû¶ô¡BÁ¦±ø¡B¥i¼Ö"
  44.                 .List(.ListCount - 1, 1) = 47           'ComboBox2ªº²Ä2Äæ  ¨SÅã¥Ü¥X¨Ó
  45.                 .AddItem "Âû¶ô¡BÁ¦»æ¡B¥i¼Ö"
  46.                 .List(.ListCount - 1, 1) = 46
  47.                 .AddItem "Âû¶ô¡BÁ¦»æ¡B¬õ¯ù"
  48.                 .List(.ListCount - 1, 1) = 45
  49.             Case 2             '¤T¸¹À\
  50.                 .AddItem "«p¤g¥q¡BÁ¦±ø¡B¥i¼Ö"
  51.                 .List(.ListCount - 1, 1) = 44           'ComboBox2ªº²Ä2Äæ  ¨SÅã¥Ü¥X¨Ó
  52.                 .AddItem "«p¤g¥q¡BÁ¦»æ¡B¥i¼Ö"
  53.                 .List(.ListCount - 1, 1) = 43
  54.                 .AddItem "«p¤g¥q¡BÁ¦»æ¡B¬õ¯ù"
  55.                 .List(.ListCount - 1, 1) = 42
  56.         End Select
  57.     End With
  58.     TextBox1 = ""
  59. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-3-7 18:22 ½s¿è

¦^´_ 5# Jared

ªþÀɸոլÝ

test.rar (25.17 KB)





  1. 'ListIndex = -1: ©Ò¿ïªº¤£¦b List²M³æ¤º
  2. Private Sub ComboBox1_Change()
  3.     If ComboBox1.ListIndex > -1 Then
  4.         À\ÂI
  5.     Else
  6.          ListBox1.RowSource = ""
  7.     End If
  8. End Sub
  9. Private Sub CommandButton1_Click()
  10.     Dim A
  11.     If ComboBox1.ListIndex = -1 Or Me.ListBox1.ListIndex = -1 Then MsgBox "À\ÂI¤º®e »Ý»ô¥þ !!": Exit Sub
  12.     With Sheet10
  13.         .Cells(.Rows.Count, 1).End(xlUp).Offset(1).Resize(, 3).Value = Array(ComboBox1, ListBox1.List(ListBox1.ListIndex, 0), ListBox1.List(ListBox1.ListIndex, 1))
  14.     End With
  15. End Sub
  16. Private Sub CommandButton2_Click()
  17.     test4.Hide
  18. End Sub
  19. Private Sub CommandButton3_Click()
  20.     ComboBox1 = ""
  21. End Sub
  22. Private Sub UserForm_Initialize()
  23.     With ListBox1
  24.         .ColumnWidths = .Width * (2 / 3) & "," & .Width * (1 / 3)   'Åã¥ÜÄæ¼e«×
  25.         .ColumnHeads = True                                         'Äæ¦ìÅã¥Ü ªíÀY
  26.         .TextAlign = fmTextAlignCenter                              '¤å¦r¸m¤¤
  27.         .ColumnCount = 2                                            'Åã¥ÜÄæ¦ì¼Æ  À\ÂI¤º®e,»ù¿ú ¨âÄæ
  28.        .Font.Size = 12
  29.     End With
  30.     With ComboBox1
  31.         .Font.Size = 12
  32.         .TextAlign = fmTextAlignCenter                              '¤å¦r¸m¤¤
  33.     End With
  34.     ®MÀ\©w¸q
  35. End Sub
  36. Private Sub À\ÂI()
  37.     With ListBox1
  38.         .RowSource = ""                                             '²M°£ListBox ²M³æªº¨Ó·½
  39.         .RowSource = Sheets("®MÀ\").Names(ComboBox1.Value).RefersTo '«ü©wListBox ²M³æªº¨Ó·½ A1:C5 ½d³òªº§Î¦¡(¤£¬O R1C1)
  40.     End With
  41. End Sub
  42. Private Sub ®MÀ\©w¸q()          '©w¸q¦WºÙ
  43.     Dim R As Variant, i As Integer
  44.     With Sheets("®MÀ\")
  45.         For Each R In .Names
  46.             R.Delete                '²M°£®MÀ\ªº©w¸q¦WºÙ
  47.         Next
  48.         Set R = .[A1]
  49.         i = 1
  50.         Do While .Cells(i, "A") <> ""
  51.             Set R = R.End(xlToRight)
  52.             ComboBox1.AddItem .Cells(i, "A")
  53.             .Names.Add Name:=.Cells(i, "A"), RefersTo:=.Range(R.CurrentRegion.Rows(2), R.CurrentRegion.Rows(R.CurrentRegion.Rows.Count))
  54.             '.Names.Add ·s¼W ®MÀ\ªº©w¸q¦WºÙ
  55.             i = i + 1
  56.             Set R = R.End(xlToRight)
  57.         Loop
  58.     End With
  59. End Sub
½Æ»s¥N½X

TOP

¦^´_ 8# Jared
   
²Ä¤@ºØ¼gªk¥Ø«e´N¬O¿ï¾Ü§¹²Ä¤@­ÓComboBox1
²Ä¤G­Ó¿ï¶µ·|¥ý©IÀ³ªÅ¥Õ
¥u¬O·Q­nÅý¥L´£«e¥ýÅã¥Ü¥X¨Ó²Ä¤@¶µ

¬O³o¼Ë¶Ü?  1#ªí³æªºµ{¦¡½X
  1. 'ListIndex = -1: ©Ò¿ïªº¤£¦b List²M³æ¤º
  2. Dim »ù®æ
  3. Private Sub ComboBox1_Change()
  4.     ComboBox2 = ""
  5.     TextBox1 = ""
  6.     If ComboBox1.ListIndex > -1 Then
  7.         ComboBox2 = ComboBox2.List(ComboBox1.ListIndex)
  8.         TextBox1 = »ù®æ(ComboBox1.ListIndex)
  9.     End If
  10. End Sub
  11. '   Private Sub ComboBox2_Change()
  12. '       TextBox1 = ""
  13. '       If ComboBox2.ListIndex > -1 Then TextBox1 = »ù®æ(ComboBox1.ListIndex)
  14. '   End Sub
  15. '****************************************************
  16. Private Sub CommandButton1_Click()
  17.     If ComboBox1.ListIndex = -1 Then MsgBox "À\ÂI¤º®e »Ý»ô¥þ !!": Exit Sub
  18.     With Sheet10
  19.         .Cells(.Rows.Count, 1).End(xlUp).Offset(1).Resize(, 3).Value = Array(ComboBox1, ComboBox2, TextBox1)
  20.     End With
  21. End Sub
  22. Private Sub CommandButton2_Click()
  23.     test4.Hide
  24. End Sub
  25. Private Sub CommandButton3_Click()
  26.     ComboBox1 = ""
  27. End Sub
  28. Private Sub UserForm_Initialize()
  29.     With ComboBox1
  30.         .Font.Size = 12
  31.         .TextAlign = fmTextAlignCenter                  '¤å¦r¸m¤¤
  32.         .List = Array("¤@¸¹À\", "¤G¸¹À\", "¤T¸¹À\")
  33.     End With
  34.     With ComboBox2
  35.         .Font.Size = 12
  36.         .TextAlign = fmTextAlignCenter                  '¤å¦r¸m¤¤
  37.         .List = Array("º~³ù¡BÁ¦±ø¡B¥i¼Ö", "Âû¶ô¡BÁ¦»æ¡B¬õ¯ù", "Á¦»æ¡BÁ¦±ø¡B¦B²N²O")
  38.         .Locked = True                                  '¸T¤î½s¿è
  39.     End With
  40.     With TextBox1
  41.         .Locked = True                                  '¸T¤î½s¿è
  42.         .Font.Size = 12
  43.         .TextAlign = fmTextAlignCenter                   '¤å¦r¸m¤¤
  44.     End With
  45.     »ù®æ = Array(50, 60, 70)
  46. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¦Y­W¤F­W¡B­WºÉ¤Ü¨Ó¡A¨ÉºÖ¤FºÖ¡BºÖºÉ´d¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD