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

[µo°Ý] ¦p¦ó³]©w

¦^´_ 5# acdx
  1. Option Explicit
  2. Dim Ob(), Msg As Boolean
  3. Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'ªí³æÃö³¬®É·|°õ¦æ¦¹µ{¦¡
  4.     If Text_Checking(TextBox1) = False Then Cancel = True        'ªí³æ¾nÂI¯d¦bTextBox1¤W
  5. End Sub
  6. Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
  7.     If Text_Checking(TextBox2) = False Then Cancel = True
  8. End Sub
  9. Private Function Text_Checking(T As MSForms.TextBox) As Boolean
  10.     Dim I As Variant
  11.     Text_Checking = True                   '¹w³]¬° True
  12.     If Msg Then Exit Function              'ªí³æ¤wÃö³¬
  13.     I = Application.Match(Val(T), Ob, 0)   '§ä¤£¨ì
  14.     If IsError(I) Then Text_Checking = False
  15.     If Text_Checking = False Then MsgBox T & " ¤£¬O¥¿½Tªº¼Æ¦r" & vbLf & Join(Ob, vbTab) & vbLf & "¥H¤W¬°¥¿½Tªº¼Æ¦r"
  16. End Function
  17. Private Sub UserForm_Initialize()
  18.     Ob = Array(100, 125, 160, 200, 250, 315, 400, 500, _
  19.                 630, 800, 1000, 1250, 1600, 2000, 2500, 3150, _
  20.                 4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000)
  21. End Sub
  22. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
  23.     Msg = True                'ªí³æÃö³¬®ÉÅܼƳ]¬°  True
  24. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 9# stillfish00
Match ¤£¬O¯S¨Ò, ¨Ï¥ÎApplication.WorksheetFunction¨ä¥L¨ç¼Æ¶Ç¦^¿ù»~­È,VBA ·|¦³²£¥Í¿ù»~­È.
  1. Option Explicit
  2. Sub TEST()
  3.     Dim A As Variant
  4.     A = Application.Match(999, Array(1, 2, 3), 0)
  5.     If IsError(A) Then MsgBox "Not found"
  6.     '¥i¥Î [ ­pºâ¬¡­¶Ã¯ªº¦WºÙ©Î¨ç¼Æ ]
  7.     A = [MATCH(999,{1, 2, 3},0)]  '[ ³o¤£¥i¥ÎÅܼÆ(­pºâ¬¡­¶Ã¯ªº¦WºÙ©Î¨ç¼Æ) ]
  8.     If IsError(A) Then MsgBox "Not found"
  9.     ' **** Åܳq¤è¦¡******************
  10.     Names.Add "AAA", Array(1, 5, 100, 3)
  11.     Names.Add "B", 100
  12.     If IsError([MATCH(B,AAA,0)]) Then
  13.         MsgBox "Not found"
  14.     Else
  15.         MsgBox [MATCH(B,AAA,0)]
  16.     End If
  17. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-9-4 12:26 ½s¿è

¦^´_ 6# acdx
  1. Private Sub UserForm_Initialize()   'ExportResult(ªí³æ¼Ò²Õ)
  2. Dim Ob()   '<-³oDim Ob ÅÜ¼Æ ¥u¥i¥H¦b UserForm_Initializeµ{§Ç¤¤¨Ï¥Î
  3. Ob = Array(100, 125, 160, 200, 250, 315, 400, 500, _
  4.             630, 800, 1000, 1250, 1600, 2000, 2500, 3150, _
  5.             4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000)
  6. End Sub
½Æ»s¥N½X
  1. Option Explicit         'ExportResult(ªí³æ¼Ò²Õ)
  2. Dim Ob(), Msg As Boolean  ' ³o¨â¦æµ{¦¡½X ½Ð©ñ¦b ExportResult(ªí³æ¼Ò²Õ)ªº³Ì¤WºÝ
  3. (¦p¦¹³oDim Ob ÅܼÆ,ExportResult(ªí³æ¼Ò²Õ)©Ò¦³µ{¦¡¥i¥G¥sªº)
  4. Private Sub CommandButton2_Click()
  5. Unload Me
  6. ALtoolbox.Show
  7. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¬°¤H³B¥@­n¤p¤ß²Ó¤ß¡A¦ý¤£­n¡u¤p¤ß²´¡v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD