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

[µo°Ý] vba·s¤âµo°Ý

Select Case  ¨Ó´À¥N If else
Sub iif4()
    Dim arr, i
    arr = Range([a20], [a65536].End(3))
    For i = 1 To UBound(arr)
        Select Case arr(i, 1)
        Case Is >= 100
            arr(i, 1) = "³q¹L"
        Case Is >= 0
            arr(i, 1) = "¤£³q¹L"
        Case Else
            arr(i, 1) = ""
        End Select
    Next
    [c20].Resize(UBound(arr)) = arr
End Sub
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 11# ML089

ÁÂÁÂML089¤j¤j~
    Select Case¥Î³~¦³¤ñ¸û¼s¶Ü¡H

TOP

¦^´_ 12# wayne0303


Select Case¥Î³~¦³¤ñ¸û¼s¶Ü¡H
>> Select Case ©M if elseif¡A»yªk¼gªk¤£¤Ó¤@¼Ë¡A¦ý¹ê»Úµ²ªG¬O¤@¼Ëªº¡A¬Ý­Ó¤H³ß¦n¨Ï¥Î¡A·PÁ¡C

TOP

¦^´_  ML089

ÁÂÁÂML089¤j¤j~
    Select Case¥Î³~¦³¤ñ¸û¼s¶Ü¡H
wayne0303 µoªí©ó 2021-9-7 17:55


­Y¬O¤@­ÓÅܼƥu¦³2~3ºØ§PÂ_¡A¥Î IF ¤ñ¸û²³æ¡A3­Ó¥H¤W§PÂ_¥i¥H¦Ò¼{¥Î Select Case
¹³¤U¦C½d¨Ò¤§¦h¶µ§PÂ_¥ÎIF´N«Ü²Ö§a!

Select Case number
    Case 1 To 5
        Debug.WriteLine("Between 1 and 5, inclusive")
        ' The following is the only Case clause that evaluates to True.
    Case 6, 7, 8
        Debug.WriteLine("Between 6 and 8, inclusive")
    Case 9 To 10
        Debug.WriteLine("Equal to 9 or 10")
    Case Else
        Debug.WriteLine("Not between 1 and 10, inclusive")
End Select
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

Sub iif3()
    Dim arr, i&,V,T$
    arr = Range([a20], [a65536].End(3))
    For i = 1 To UBound(arr)
         v= arr(i,1)
         t=switch(v>=100,"³q¹L",v>=0,"¤£³q¹L",v=v,"")
         arr(i, 1) = t
    Next
    [c20].Resize(UBound(arr)) = arr
End Sub

TOP

¦^´_ 13# samwang


·PÁÂsamwang¤j¤j ¸Ñµª~

TOP

¦^´_ 14# ML089


¤F¸Ñ~
ÁÂÁÂML089¤j¤j~

TOP

¦^´_ 15# ­ã´£³¡ªL


«z~­ã¤j³o­Óswitch§ó²¼ä~ÁÂÁÂ

TOP

        ÀR«ä¦Û¦b : ¯à¥I¥X·R¤ß´N¬OºÖ¡A¯à®ø°£·Ð´o´N¬O¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD