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

¸ê®Æ­åªR(TextToColumns)¹ï¶H¥i¥H¤£¬OÀx¦s®æ¶Ü?

¦^´_ 10# chiata
  1. Sub test1()
  2.     Dim t As Integer
  3.     For t = 1 To 110
  4.         If t <= "9" Then MsgBox t & " <= 9"
  5.         If t <= "10" Then MsgBox t & " <= 10"
  6.     Next t
  7. End Sub
  8. Sub test2()
  9.     't ¨S¦³©ú½T«Å§i   
  10. For t = 1 To 110
  11.         If t > "30" Then MsgBox t & " > 30"         '·ít<=9 ¬°1¦ì¼Æ ¤ñ¹ï¦r¦êªº²Ä¤@¦ì "3"
  12.         If t <= "9" Then MsgBox t & " <= 9"        '·ít<=9 ¬°1¦ì¼Æ ¤ñ¹ï¦r¦êªº²Ä¤@¦ì "9"
  13.         If t <= "10" Then MsgBox t & " <= 10"   '·ít<=9 ¬°1¦ì¼Æ ¤ñ¹ï¦r¦êªº²Ä¤@¦ì "1"
  14.         MsgBox TypeName(t)
  15.     Next t
  16. End Sub
½Æ»s¥N½X

TOP

¦^´_  GBKEE
ÁÂÁÂG¤j¡A·s¦~§Ö¼Ö¡A
¹Ï¤¤Variant/Integer¤£¬O¥Nªí¦¹Åܼƥثe¬OIntegerªºª¬ºA¶Ü ...
chiata µoªí©ó 2013-2-9 16:23



t ¬O variant/Integer ¬O¹ïªº.
¦ý¬O·í ¦bif ªº®É­Ô
¦]¬°¥k¤è "10" ¬O ¤å¦r, ¤£¬O¼Æ¦r,  if·|§âtÂର¤å¦r¦A¹ï¤ñ (VBA¨Ó¬Ý, " "¸Ìªº¬O¤å¦r)

¨Ò¦pt = 6
if ªº®É­Ô
if (t<="10") then....
·|Åܦ¨
if ("6"<="10") then....
¦Ó¤£¬O
if (6<=10) then....

¦Ó¤å¦r"6" ²Ä1­Ó¦r §Y "6"  ¤ñ "10"ªº²Ä1­Ó¦r "1" ¤j
´«¥y¸Ü»¡ "6"<="10" ´N¬Oµ¥©óFALSE

TEST­n³o¼Ë¼g¤~¥i¥H±o¥X®ÄªG
  1. Option Explicit         '±j¨î»Ý«Å§iÅܼÆ
  2. Sub test()
  3.    Dim t As Integer
  4.    For t = 1 To 110
  5.        If t <= 15 Then MsgBox t
  6.    Next t
  7. End Sub

  8. Sub test2()
  9.     Dim t As Variant  
  10.     For t = 1 To 110
  11.        If t <= 15 Then MsgBox t & " <= 10"
  12.    Next t
  13. End Sub
½Æ»s¥N½X
¤£«ü©úÃþ«¬,¬O·|¤ñ¸û¤è«K¨Ç, ¦ý¬O·|¼W¥[¹³³o¼Ëªº¿ù»~¾÷·|.
·L³nªñ¦~¨Ó¹ïVariantªº¤è°w¤]¬OÅܨÓÅÜ¥h.
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¨Ò¦pt = 6
if ªº®É­Ô
if (t<="10") then....
·|Åܦ¨
if ("6"<="10") then....
¦Ó¤£¬O
if (6<=10) then....
kimbal µoªí©ó 2013-2-16 17:07


ÁÂÁ¦U¦ì«e½ú¡A§Ú¾é¸Ñ¤F!
¦ý¦ü¥G¤@¨B¤@¨B°õ¦æµ{¦¡¡A¦bIf t <= 10¸òIf t <= "10"¤¤tªº«¬ºA³£ÁÙ¬Ovariant/Integer¡A¥i¬O¹ê»Ú¤W¦bIf t <= "10"®ÉVBA¬O¥Îvariant/String¥h§PÂ_?
  1. Sub test()
  2.     Dim t As Variant
  3.     For t = 1 To 10
  4.         If t <= 10 Then MsgBox t & " <= 10"
  5.         If t <= "10" Then MsgBox t & " <= 10"
  6.     Next t
  7. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤£­nÀH¤ß©Ò±ý¡A­nÀH¤ß±Ð¨|¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD