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

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

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

½Ð±Ð¦U¦ì«e½ú
Selection.TextToColumns
¨ä¤¤Selection¦ü¥G¤@©w­n¬Orange¡A¨º¦³¿ìªkª½±µ¹ï°}¦CÅܼƶi¦æ¸ê®Æ­åªR¶Ü?

ex:dim A(3) as double
A(0)="1,2,3"
·Q¤£³z¹Lsheet§â¸ê®Æ­åªR¦¨A(1)=2¡BA(2)=2¡BA(3)=3
¦³¿ìªk³o¼Ë°µ¶Ü?

ÁÂÁÂ

¨Ò¦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

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

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

¦^´_ 9# GBKEE


   

ÁÂÁÂG¤j¡A·s¦~§Ö¼Ö¡A
¹Ï¤¤Variant/Integer¤£¬O¥Nªí¦¹Åܼƥثe¬OIntegerªºª¬ºA¶Ü¡H
§Ú¥H¬°Variant¬O¥ý°ð«ü©wÅܼƫ¬ºA¡A«Ýµ{¦¡°õ¦æ«á·|¦Û°Ê§PÂ_¦¹ÅܼƦX¾A«¬ºA¡A¨Ò¦pinteger¡Bstring...µ¥¡A¨Ï¥Î¤W¤ñ¸û¦³¼u©Ê¡C
ÁÙ¬O§ÚÆ[©À¿ù»~¡H¡H

TOP

¦^´_ 8# chiata
§A¨S¦³«Å§i ÅܼÆtªº«¬ºA¬°¼Æ¦r,vba±Nµø¬° ¦r¦êªº¹ï¦r¦êªº¤ñ¹ï
  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  ' Variant ¸ê®Æ«¬ºA¬O©Ò¦³¨S³Q©ú½T«Å§i¬°¨ä¥L«¬ºA  **µ¥¦P¨S¦³«Å§iÅܼÆ***
  10.     For t = 1 To 110
  11.         If t <= "10" Then MsgBox t & " <= 10"
  12.         If t <= "20" Then MsgBox t & " <= 20"
  13.         If t <= "30" Then MsgBox t & " <= 30"
  14.     Next t
  15. End Sub
½Æ»s¥N½X

TOP

¦^´_ 7# GBKEE
  1. Sub test()

  2.     For t = 1 To 110
  3.         If t <= "10" Then MsgBox t
  4.     Next t
  5.    
  6. End Sub
  7. Sub test2()

  8.     For t = 1 To 110
  9.         If t <= Val("10") Then MsgBox t
  10.     Next t
  11.    
  12. End Sub
½Æ»s¥N½X
¤p§Ì¹J¨ìªº°ÝÃD...test¥u¦³t=1¸ò10·|¸õmsgbox¥X¨Ó¡Atest2´Nt=1~10³£·|¸õ¡A¤£ª¾¹D¬O­þÃä¥X°ÝÃD...
ÁÂÁÂ

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-2-5 16:37 ½s¿è

¦^´_ 6# chiata
¨Ï¥Îµo²{¦r¦ê¥i¥H¹Bºâ¡A¦ý¤£¯à°µ<¡B=¡B>µ¥§PÂ_
  1. Option Explicit
  2. Sub Ex()
  3.     Dim A As String, B As Variant
  4.     A = "A5"
  5.     B = "10"
  6. '    MsgBox A * B   '** VBA ¶Ç¦^: ¿ù»~­È13  "«¬ºA¤£²Å¦X"
  7.     If IsNumeric(A) And IsNumeric(B) Then MsgBox A * B Else MsgBox "«¬ºA¤£²Å¦X"
  8.     A = "5"
  9.     B = "10"
  10.     If IsNumeric(A) And IsNumeric(B) Then MsgBox A * B Else MsgBox "«¬ºA¤£²Å¦X"
  11.     A = "1,2,3,4,5,6,7,8,9,10"
  12.     B = Split(A, ",")
  13.     MsgBox B(0) * B(UBound(B))
  14.     MsgBox B(0) < B(UBound(B))  '1 < 10 =True
  15.     MsgBox B(0) > B(UBound(B))  '1 > 10 =False
  16.     MsgBox B(0) = B(UBound(B))  '1 = 10 =False  
  17.     A = "1,2,3,4,5,6,7,8,9,A10"
  18.     B = Split(A, ",")
  19.     MsgBox B(0) * B(UBound(B))    '** VBA ¶Ç¦^: ¿ù»~­È13  "«¬ºA¤£²Å¦X"
  20. End Sub
½Æ»s¥N½X

TOP

¦^´_ 5# Hsieh

ÁÂÁ¡A§Ú²z¸Ñ¤F!
­è­è¨Ï¥Îµo²{¦r¦ê¥i¥H¹Bºâ¡A¦ý¤£¯à°µ<¡B=¡B>µ¥§PÂ_¡A¥u¯à­n§PÂ_®É¨Ï¥Îval©Î¬O¹³H¤j©Ò»¡ªº¦s¦¨¥t¤@­Ó°}¦C¨Ó¨Ï¥Î¡C

TOP

¦^´_ 4# chiata

¦b2#¦^ÂФ¤¤w¸g»¡©úSPLIT©Ò±o¨ìªº¬O¦r¦ê«¬ºAªº°}¦C
¦Ó°}¦CµLªk§ïÅܨä¸ê®Æ«¬ºA¡A°ß¦³¥H¥t¤@¸ê®Æ«¬ºA°}¦CÀx¦s¤~¥i§ïÅܤ¸¯Àªº¸ê®Æ«¬ºA
  1. Sub ex()
  2. Dim ar()
  3. a = "1,3,5,7,9"
  4. bb = Split(a, ",")
  5. ReDim ar(UBound(bb))
  6. For i = 0 To UBound(bb)
  7. ar(i) = CDbl(bb(i))
  8. MsgBox ar(i) & "  IS  " & TypeName(ar(i))
  9. Next
  10. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦pÆp¥Û¡j®É¶¡¹ï¤@­Ó¦³´¼¼zªº¤H¦Ó¨¥¡A´N¦pÆp¥Û¯ë¬Ã¶Q¡F¦ý¹ï·M¤H¨Ó»¡¡A«o¹³¬O¤@§âªd¤g¡A¤@ÂI»ù­È¤]¨S¦³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD