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

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

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

§Ú­n­­¨îTextBox1¤ÎTextBox2©Ò¿é¤Jªº¼Æ­È¥²¶·¬°"100, 125, 160, 200, 250, 315, 400, 500,630, 800, 1000, 1250, 1600, 2000, 2500, 3150,4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000",­Y¤£¬O«h¸õ¥Xĵ§iµøµ¡ ³o¸Ó«ç»ò¼g?
¥i§_¨Ï¥Î¯x°}
OB = Array(100, 125, 160, 200, 250, 315, 400, 500, _
                630, 800, 1000, 1250, 1600, 2000, 2500, 3150, _
                4000, 5000, 6300, 8000, 10000, 12500, 16000, 20000)
µM«á¸Ó«ç»ò¼g¤ñ¸û¦n?

RE: ¦p¦ó­­¨î¤å¦r¤è¶ô¤º®e?

¦^´_ 1# acdx
¥Ø«e·Qªk¬OÅý
T1=TextBox1.Value¥BT1¥²¶·¬°¯x°}OB¤¤ªº¼Æ¦r,§_«h§YÅã¥Ü"½Ð¿é¤J¥¿½T¼Æ­È"
¸Ó¦p¦óÅýµ{¦¡ÀˬdT1¬O§_¬°¯x°}¤¤ªº¼Æ©O?

TOP

¦^´_ 4# acdx
¥i¥H§ï¥ÎCombobox¡AÅý¨Ï¥ÎªÌ¥u¯à±q¤W­z¼Æ­È¿ï
  1. Private Sub UserForm_Initialize()
  2.   '¥[¤W¥H¤U¨â¦æ
  3.   ComboBox1.List = 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.   ComboBox1.Style = fmStyleDropDownList
  7. End Sub
½Æ»s¥N½X

TOP

¦^´_ 5# stillfish00
¦]¬°Ä±±o¨Ï¥ÎComboBox¹ï¨Ï¥ÎªÌ¨Ó»¡¸û¤£¤è«K(¿é¤J³t«×ºC)©Ò¥H¤~·Q¹Á¸Õ¥ÎTextBoxª½±µ¿é¤J

TOP

¦^´_ 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

¦^´_ 6# GBKEE
¨Ì·Ó±zªº¤è¦¡§ï¦n«á
TextBox1¿é¤J«á­n¿ïTextBox2Ä~Äò¿é¤J®É´N¥X²{¿ù»~

ªþ¤WÀÉ®×:»Ý¦w¸Ë¼W¯q¶°ToolBox
¶}±Òtest.xlsx->°õ¦æ¼W¯q¶°->ÂI¿ïExport Test Result->¿ï¾ÜSound Pressure, ¿é¤JÀW²v½d³ò->"Export >"
Tool.zip (137.85 KB)

TOP

¦^´_ 7# acdx
±K½X:2945

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-9-3 20:05 ½s¿è

¦^´_ 6# GBKEE
ª©¥D¡A½Ð±Ð¤@¤U
¤§«e¦Û¤v¸Õ¼g¡A¨Ï¥Î Application.WorksheetFunction.Match ¥h´M§ä°}¦C¤¸¯À¡A§ä¤£¨ì®ÉÁ`·|¥X²{¿ù»~ 1004¡A¾É­P±j¨î°»¿ù..¨Ï¥Î¤W«Ü¤£¤è«K¡A§ï¥Î Application.Match ¤Ï¦Ó´N¤£·|¤F¡A¤Q¤À¤è«K¡AÃø¹D³o¨â­Ó¬O¤£¦P function ?

¨º»ò Match ¬O¯S¨Ò¶Ü ? ¬O§_¨ä¥L·|¶Ç¦^ #N/A ¿ù»~­Èªº WorksheetFunction  ¨ç¼Æ¡A³£¯à³o¼Ë¥Î©O ?
  1. Sub TEST()
  2.   'If IsError(Application.Match(999, Array(1, 2, 3), 0)) Then MsgBox "Not found"
  3.   'If IsError(Application.WorksheetFunction.Match(999, Array(1, 2, 3), 0)) Then MsgBox "Not found"
  4. End Sub
½Æ»s¥N½X

TOP

¦^´_ 9# stillfish00

ºô¸ô¤W§äªº½d¨Ò´£¨Ñ°Ñ¦Ò¡A
¬Ý¨Ó application.XXX »P WorksheetFunction.XXX©Îapplication.WorksheetFunction.XXX¥Îªk½T¦³¤£¦P
  1. Sub test2()
  2.     Dim v As Variant
  3.     For Each i In Array(2, 7)
  4.     Debug.Print i
  5.    
  6.     ' v is assigned Error 2042
  7.     v = Application.Match(i, Array(1, 2, 3), 0)
  8.     Debug.Print "Application"; Tab(25); v
  9.     Debug.Print "Err.Number"; Tab(25); Err.Number
  10.     Debug.Print
  11.    
  12.     ' trappable error generated, no assignment to v
  13.     v = Empty
  14.     On Error Resume Next
  15.     v = WorksheetFunction.Match(i, Array(1, 2, 3), 0)
  16.     Debug.Print "WorksheetFunction"; Tab(25); v
  17.     Debug.Print "Err.Number"; Tab(25); Err.Number
  18.     Debug.Print
  19.     On Error GoTo 0
  20.    
  21.     ' run-time error, no assignment to v
  22.     v = WorksheetFunction.Match(i, Array(1, 2, 3), 0)
  23.    
  24.     Next
  25. End Sub
½Æ»s¥N½X
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

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

        ÀR«ä¦Û¦b : ¯àµ½¥Î®É¶¡ªº¤H¡A¥²¯à´x´¤¦Û¤v§V¤Oªº¤è¦V¡C
ªð¦^¦Cªí ¤W¤@¥DÃD