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

[µo°Ý] ¥X²{RUN-TIME ERROR '9': SUBSCRIPT OUT OF RANGE,½Ð°Ý­þ¸Ì¥X²{°ÝÃD¡H

½Ð°Ývba left ¥Îªk

¨Ò¦p¡G
A1 Àx¦s®æ   207171      ¦p¦óª¾¹DA1Àx¦s®æ¤ºªº²Ä¤@­Ó¦r¬O¤£¬O2¦r    if left(A1¡A1¡^= 2 then
A2Àx¦s®æ    74171   ¦p¦óª¾¹DA2Àx¦s®æ¤ºªº²Ä¤@­Ó¦r¬O¤£¬O7     if left(A2¡A1¡^= 7 then
A3Àx¦s®æ    OBL,OHC            ¦p¦óª¾¹DA3Àx¦s®æ¤ºªº²Ä¤@­Ó¦r¬O¤£¬Oobl     if left(A3¡A3¡^= "OBL" then
³o¼Ë¼g¹ï¶Ü¡H

TOP

¦^´_ 1# 198188
  1. if left([A1]¡A1¡^= 2 then
  2.     ' .......
  3. end if

  4. if left([A2]¡A1¡^= 7 then
  5.     ' .......
  6. end if

  7. if left([A3]¡A3¡^= "OBL" then
  8.     ' .......
  9. end if
½Æ»s¥N½X

TOP

¦^´_ 2# c_c_lai

¥t¥~½Ð°Ý¦pªG¬O¤£§t¬Y­Ó¦rªº¼gªk
    ="<>""*OBL*"
         <>"*OBL*"
­þ­Ó¤~¹ï¡AÁÙ¬O¨â­Ó³£¤£¹ï¡H

TOP

¦^´_ 3# 198188

dim vari
if not ( vari like "*OBL*") then
...
end if
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

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

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2012-12-17 22:21 ½s¿è

¦^´_ 3# 198188

¤£¥]§t¬Y¦r¦êOBL
If Instr([A1],"OBL")=0 Then
¦r­º¬°OLB
If Instr([A1],"OBL")=1 Then
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2012-12-18 07:27 ½s¿è

¦^´_ 3# 198188
»P Hsieh ¤jªº Instr() ¦³¤£¦Pªºªí¹F¤è¦¡¡A »P Kimbal ª©¤jªº¬O¦P¼Ëªº·N«ä¡A½Ð°Ñ¦Ò¡I
  1. Sub Test5()
  2.     If Not [A1] Like "*OBL*" Then   '  [A1] = "ABCDEFG"
  3.         [B1] = "Not *OBL*"
  4.     Else                            '  [A1] = "ABCODLDE"
  5.         [B1] = "I Got it!"
  6.     End If
  7. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-12-18 09:43 ½s¿è

¦^´_ 6# c_c_lai
  1. VABªº»¡©ú

  2. Boolean ¸ê®Æ«¬ºA
  3. Boolean ÅܼƫY¥H 16 ¦ì¤¸( 2 ­Ó¦ì¤¸²Õ)¼Æ¦rªº§Î¦¡Àx¦s¡A¦ý¥u¯à¬O True ©Î¬O False¡CBoolean Åܼƪº­È¤£¬O True ´N¬O False ( ¦b¨Ï¥Î Print ªº®É­Ô )¡A©Î¬O #TRUE# ©M #FALSE# ( ¦b¨Ï¥Î Write # ªº®É­Ô )¡C¨Ï¥ÎÃöÁä¦r True »P False ¥i±N Boolean Åܼƫü©w¬°³o¨â­Óª¬ºA¤¤ªº¤@­Ó¡C
  4. ·íÂà´«¨ä¥Lªº¼Æ­È«¬ºA¬° Boolean ®É¡A0 ·|Âন False¡A¦Ó©Ò¦³¨ä¥Lªº­È«hÅܦ¨ True¡C·íÂà´« Boolean ­È¬°¨ä¥Lªº¸ê®Æ«¬ºA,®É¡AFalse ¦¨¬° 0 ¡A¦Ó True ¦¨¬° -1¡C

  5. If .[¹Bºâ¦¡±ø¥ó]..Then...Else ³¯­z¦¡  ¨ä[¹Bºâ¦¡±ø¥ó]¤§¹Bºâµ²ªG¬° True ©Î False
  6. True ©Î False ¬O Boolean ¸ê®Æ«¬ºA
½Æ»s¥N½X
  1. Sub Ex()
  2.     Dim Vari
  3.     Vari = "oBL"
  4.     '¤T­Ó¦¡¤lªº¹Bºâµ²ªG³£¤@¼Ëªº Boolean ¸ê®Æ«¬ºA
  5.     'If Vari Like "*OBL*" = False Then
  6.     'If Vari Like "*OBL*" = 0 Then
  7.     If Not Vari Like "*OBL*" Then
  8.         MsgBox Vari & " ¤£¥]§t : * OBL * "
  9.     End If
  10. End Sub
½Æ»s¥N½X
  1. Sub Ex1()
  2.     Dim Vari As String
  3.     Vari = "AOBL"
  4.     MsgBox InStr(Vari, "OBL")
  5.     If InStr(Vari, "OBL") Then  '¹Bºâµ²ªG¬O Boolean ¸ê®Æ«¬ºA
  6.     'If InStr(Vari, "OBL") > 0 Then
  7.         MsgBox Vari & " ¥]§t : * OBL * "
  8.     End If
  9. End Sub
½Æ»s¥N½X

TOP

¦^´_ 7# GBKEE
·PÁ GBKEE ª©¤jªºªþ¥[»¡©ú¡C

TOP

¦^´_ 1# 198188


    Sub oag()
    If InStr(Cells(1, 1), "2") = 1 Then
        [b1] = "2" & "¦b²Ä¤@­Ó"
    Else
        [b1] = "2" & "¤£¬O¦b²Ä¤@­Ó"
    End If

End Sub

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

TOP

¦^´_ 7# GBKEE

½Ð°Ý³o¥y¸Ü¬O¤£¬O¦³°ÝÃD¡Htype mismatch?
    .Range("D2:D" & LastRec).Value = .Range("AA2:AA" & LastRec).Value  &  .Range("AH2:AH" & LastRec).Value

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¯Ê¤fªºªM¤l¡A¦pªG´«¤@­Ó¨¤«×¬Ý¥¦¡A¥¦¤´µM¬O¶êªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD