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

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

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

[ª©¥DºÞ²z¯d¨¥]
  • Hsieh(2012-12-26 16:41): ­n°»¿ùµ{¦¡½X¡A½Ðªþ¤WÀÉ®×

  1. Sub schedule()

  2.   Dim i As Integer
  3.   Dim j As Integer
  4.   Dim l As Integer
  5.   
  6.   j = Worksheets("PARKER SHIPMENT").Range("A" & Worksheets("PARKER SHIPMENT").Rows.Count).End(xlUp).Row
  7.   l = 13

  8. If IsError(Application.VLookup(Worksheets("²î´Áªí").Cells(1, 1).Value, Sheets("«È¤á¸ê®Æ").Range("A:C"), 3, False)) Then
  9. Worksheets("²î´Áªí").Range("B1").Value = ""
  10. Else
  11. Worksheets("²î´Áªí").Range("B1").Value = Application.VLookup(Worksheets("²î´Áªí").Cells(1, 1).Value, Sheets("«È¤á¸ê®Æ").Range("A:C"), 3, False)
  12. End If
  13.   
  14. If IsError(Application.VLookup(Worksheets("²î´Áªí").Cells(1, 1).Value, Sheets("«È¤á¸ê®Æ").Range("A:D"), 4, False)) Then
  15. Worksheets("²î´Áªí").Range("B2").Value = ""
  16. Else
  17. Worksheets("²î´Áªí").Range("B2").Value = Application.VLookup(Worksheets("²î´Áªí").Cells(1, 1).Value, Sheets("«È¤á¸ê®Æ").Range("A:D"), 4, False)
  18. End If
  19.   
  20. If IsError(Application.VLookup(Worksheets("²î´Áªí").Cells(1, 1).Value, Sheets("«È¤á¸ê®Æ").Range("A:E"), 5, False)) Then
  21. Worksheets("²î´Áªí").Range("E8").Value = ""
  22. Else
  23. Worksheets("²î´Áªí").Range("E8").Value = Application.VLookup(Worksheets("²î´Áªí").Cells(1, 1).Value, Sheets("«È¤á¸ê®Æ").Range("A:E"), 5, False)
  24. End If
  25.   
  26. If IsError(Application.VLookup(Worksheets("²î´Áªí").Cells(1, 1).Value, Sheets("«È¤á¸ê®Æ").Range("A:G"), 7, False)) Then
  27. Worksheets("²î´Áªí").Range("L8").Value = ""
  28. Else
  29. Worksheets("²î´Áªí").Range("L8").Value = Application.VLookup(Worksheets("²î´Áªí").Cells(1, 1).Value, Sheets("«È¤á¸ê®Æ").Range("A:G"), 7, False)
  30. End If

  31.   

  32.   For i = 2 To j
  33.   
  34.   If Worksheets("PARKER SHIPMENT").Cells(i, 4).Value = Worksheets("²î´Áªí").Range("B1").Value Then
  35.   Worksheets("²î´Áªí").Cells(l, 3).Value = Worksheets("PARKER SHIPMENT").Cells(i, 2).Value
  36.   Worksheets("²î´Áªí").Cells(l, 4).Value = Worksheets("PARKER SHIPMENT").Cells(i, 1).Value
  37.   Worksheets("²î´Áªí").Cells(l, 6).Value = Worksheets("PARKER SHIPMENT").Cells(i, 7).Value
  38.   Worksheets("²î´Áªí").Cells(l, 7).Value = Worksheets("PARKER SHIPMENT").Cells(i, 9).Value
  39.   Worksheets("²î´Áªí").Cells(l, 8).Value = Worksheets("PARKER SHIPMENT").Cells(i, 11).Value
  40.   Worksheets("²î´Áªí").Cells(l, 9).Value = Worksheets("PARKER SHIPMENT").Cells(i, 12).Value
  41.   Worksheets("²î´Áªí").Cells(l, 10).Value = Worksheets("PARKER SHIPMENT").Cells(i, 13).Value
  42.   Worksheets("²î´Áªí").Cells(l, 11).Value = Worksheets("PARKER SHIPMENT").Cells(i, 14).Value
  43.   Worksheets("²î´Áªí").Cells(l, 12).Value = Worksheets("PARKER SHIPMENT").Cells(i, 20).Value
  44.   Worksheets("²î´Áªí").Cells(l, 13).Value = Worksheets("PARKER SHIPMENT").Cells(i, 21).Value

  45.   
  46.   If Worksheets("PARKER SHIPMENT").Cells(i, 19).Value = " " Then Worksheets("²î´Áªí").Cells(l, 5).Value = "¨S¦³"
  47.   Else
  48.   Worksheets("²î´Áªí").Cells(l, 5).Value = "¦³"
  49.   End If
  50.    
  51.   If Worksheets("PARKER SHIPMENT").Cells(i, 27).Value <> " " And Worksheets("PARKER SHIPMENT").Cells(i, 28).Value > 0 And Worksheets("PARKER SHIPMENT").Cells(i, 28).Value <> " " Then
  52.     Worksheets("²î´Áªí").Cells(l, 14).Value = "¤w¥I´Ú"
  53.     Else
  54.     Worksheets("²î´Áªí").Cells(l, 14).Value = " "
  55.   End If
  56.   
  57.   l = l + 1
  58.   
  59.   
  60.   Next i
  61.   
  62. End Sub
½Æ»s¥N½X
¥X²{RUN-TIME ERROR '9': SUBSCRIPT OUT OF RANGE,½Ð°Ý­þ¸Ì¥X²{°ÝÃD¡H

½Ð°Ý³o­Ó­¼¼Æªº¼gªk¹ï¶Ü¡H
Worksheets("Oracle").Cells(i, 19).value Àx¦s­Óªº¸ê®Æ¬O120000
Worksheets("Oracle").Cells(i, 22).Valueªº Àx¦s­Óªº¸ê®Æ¬O30% 7 DAY.
Worksheets(customer).Cells(cnt, 6).Value = Worksheets("Oracle").Cells(i, 19).value * Left((Worksheets("Oracle").Cells(i, 22).Value), 3)

TOP

¦^´_ 51# 198188
¤é´Á³£·|¥X²{ : ³o¬OÀx¦s®æªº¤é´Á®æ¦¡
§A¥u»¡ ETA Äæset >=41291  §A»Ý­n¬d¬Ý¾ã­Óµ{¦¡­þ¸Ì¦³³]©w¤F, Àx¦s®æªº¤é´Á®æ¦¡ ¬° .NumberFormatLocal = "[$-C04]d mmmm, yy;@"
§ï¬°  .NumberFormatLocal = "G/³q¥Î®æ¦¡"
³o¨Ç®æ¦¡µ{¦¡½X ¥i¥Î¿ý»s¥¨¶°±o¨ì
PS : $-C04 ­»´ä¦a°Ï ªº®æ¦¡¥N¸¹

TOP

¦^´_ 49# GBKEE

ETA
>=41291

½Ð°Ý§Ú±Nrule ETA Äæset >=41291¡A ¦ý¤U­±ªº¤é´Á³£·|¥X²{¡A¬O¬°¤°»ò¡H

    ETA
18-Dec-11
18-Dec-11
24-Dec-11
25-Feb-12
14-Jan-12
1-Feb-12
11-Feb-12
17-Feb-12
12-Feb-12
20-Feb-13
11-Feb-12
12-Feb-12
7-Mar-12
13-Feb-12
13-Feb-12
25-Feb-12
25-Feb-12
22-Feb-12
20-Mar-12
20-Mar-12
20-Mar-12

TOP

¦^´_ 49# GBKEE


  ·PÁ¡C¤w¸gª¾¹D°ÝÃD©Ò¦b¡A§Úªº¹q¸£¬O¶g¤»©ÎªÌ¶g¤é¡A¤£¬O¬P´Á¤»©ÎªÌ¬P´Á¤é

TOP

¦^´_ 48# 198188
Debug.Print¥i¦b §Y®É¹Bºâµøµ¡  ¤¤¬d¬Ý  The_day ¶Ç¦^ªº¦r¦ê
   
  1. The_day = Format(Worksheets("Request").Range("F" & i).Value - 2, "AAA")  '¶Ç¦^¬P´Á?
  2.     Debug.Print The_day   ' *** Debug.Print¥i¦b §Y®É¹Bºâµøµ¡  ¤¤¬d¬Ý  The_day ¶Ç¦^ªº¦r¦ê
  3.     If The_day = "¬P´Á¤»" Or The_day = "¬P´Á¤é" Then
½Æ»s¥N½X



TOP

¦^´_ 47# GBKEE


   

¹B¦æ¥X¨Óªºµ²ªGÁÙ¬O¤@¼Ë¡A¤£À´±o¿ë»{¬P´Á¤»©ÎªÌ¬P´Á¤é

TOP

¦^´_ 46# 198188
§ï¦¨
  1. .Range("H" & i).Value
½Æ»s¥N½X

TOP

¦^´_ 45# GBKEE


     .Range("H" & i).Text = .Range("F" & i).Value - 2
°õ¦æ¶¥¬q¿ù»~¡¥1004¡¦
µLªk³]©wºØÃþrangeªºtext ÄÝ©Ê

TOP

¦^´_ 44# 198188
¸Õ¸Õ¬Ý
  1. '6¡^
  2. Sub Request()
  3.     Dim rngSrc As Range, rngCopyField As Range, rngFilter As Range
  4.     Dim nextRow As Long, endRow As Long
  5.     Dim LastRec As Integer
  6.     Dim i As Integer
  7.     Dim The_day As String  '<- ****
  8.     Sheets("Request").[A2:AG65536].ClearContents
  9.     Set rngSrc = Sheets("State").[A1:AG65536]
  10.     Set rngCopyField = Sheets("Rule").[B21:AH21]
  11.     Set rngFilter = Sheets("Rule").[B14].Resize(Sheets("Rule").[B14].CurrentRegion.Rows.Count, 33)
  12.      nextRow = 2
  13.     Sheets("Request").UsedRange.Offset(1).Clear
  14.     rngSrc.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:= _
  15.     rngFilter, CopyToRange:=Sheets("Request").Range("A" & nextRow)
  16.          endRow = Sheets("Request").Range("A" & Sheets("Request").Rows.Count).End(xlUp)
  17.         For i = 1 To rngCopyField.Count
  18.         If rngCopyField(i) = "N" Then
  19.             Sheets("Request").Range(nextRow & ":" & endRow).Columns(i).Clear
  20.         End If
  21.     Next
  22.         Sheets("Request").Range("A" & nextRow).Resize(1, 33).Delete Shift:=xlUp   'delete header
  23.        Set rngSrc = Nothing
  24.     Set rngCopyField = Nothing
  25.     Set rngFilter = Nothing
  26. With Worksheets("Request")
  27.    LastRec = .Range("A1").End(xlDown).Row
  28.   For i = 2 To LastRec
  29.     .Range("B" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:S"), 19, False)
  30.     .Range("C" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:AA"), 27, False)
  31.     .Range("D" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:U"), 21, False) & " - " & Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:AC"), 29, False)
  32.     .Range("E" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:AB"), 28, False)
  33.     .Range("F" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:B"), 2, False)
  34.     .Range("G" & i).Value = Application.VLookup(.Range("A" & i).Value, Sheets("State").Range("A:N"), 14, False)
  35.     The_day = Format(Worksheets("Request").Range("F" & i).Value - 2, "AAA")  '¶Ç¦^¬P´Á?
  36.     If The_day = "¬P´Á¤»" Or The_day = "¬P´Á¤é" Then
  37.         .Range("H" & i).Value = .Range("F" & i).Value
  38.     Else
  39.         .Range("H" & i).Text = .Range("F" & i).Value - 2
  40.     End If
  41.     .Range("F" & i).NumberFormatLocal = "m/d;@"   '³]©w¤é´Á®æ¦¡
  42.     .Range("H" & i).NumberFormatLocal = "m/d;@"   '³]©w¤é´Á®æ¦¡
  43.       Next
  44.     End With
  45. End Sub
½Æ»s¥N½X

TOP

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