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

[µo°Ý] ±N¦h­ÓEXCEL ¶×¨ì¤@­ÓEXCELªº°ÝÃD

¦^´_ 10# LeafYeung
On Error ³¯­z¦¡
¤@­Ó¡u±Ò°Êªº¡v¿ù»~³B²zµ{¦¡¬O¥Ñ On Error ³¯­z¦¡©Ò¥´¶}ªº¡F¤@­Ó¡u°Ê§@¤¤¡vªº¿ù»~³B²zµ{¦¡¬O¤@­Ó¤w±Ò°Êªº¿ù»~³B²zµ{¦¡¥¿¦b³B²z¿ù»~¡C¦pªG¿ù»~³B²zµ{¦¡¦b°Ê§@¤¤¤Sµo¥Í¤F¿ù»~¡A(¦b¿ù»~µo¥Í©M Resume¡AExit Sub¡AExit Function¡A©Î Exit Property ³¯­z¦¡¤§¶¡)¡A¨º»ò²{¦b¦¹µ{§Çªº¿ù»~³B²zµ{¦¡±NµLªk¦A³B²z¦¹¿ù»~¡C
©Ò¥H¡A­n³B²z¥i¯à²£¥Í¦h¦¸¿ù»~ªºµ{§Ç¡A¥²¶·¬OResume Next¡A¦Ó­nÄ~Äò³B²z´N¥²¶·²M°£·í«e¿ù»~ª«¥ó
°õ¦æ¤U­±µ{§Ç·í¥i¤F¸Ñ¿ù»~«á³B²zª¬ºA
  1. Sub test1()
  2. For i = 1 To 10
  3. k = Int((2 - 0 + 1) * Rnd + 0)
  4. On Error GoTo AAA '¿ù»~®É¸õ¦Ü
  5. B = i / k '»s³y¿ù»~
  6. Next
  7. AAA:
  8. MsgBox "³Q°£¼Æµ¥©ó=" & i & "°£¼Æµ¥©ó=" & k
  9. Err.Clear
  10. Resume Next
  11. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 10# LeafYeung

©ú¥Õ¤F.....ÁÂÁ Hsieh ªº«ü¾É

TOP

¦^´_ 9# Hsieh


    ÁÂÁÂHsieh ª©¥D

§ÚªºªþÀɤºA1~A5¤À§O¬°1~5¼Æ¦r¡A·íA1Àx¦s®æªº1¦³§ä¨ì1.xls«hB1Åã¥Ü"OK"
¦ý¦]§Ú¤´¥d¦bªº°ÝÃD¬O¥Îon error resume next·|¥þ³¡©¿²¤¿ù»~¡A¾É­PB1~B5¥þ³¡Åã¥Ü³£"OK"
YOYO

TOP

¦^´_ 13# yanto913

µ{¦¡³]­pÀ³ºÉ¶qÁקK¿ù»~²£¥Í¤~¬O¥¿¹D
  1. Sub test()
  2. Dim sht()
  3. Application.ScreenUpdating = False 'Ãö³¬¿Ã¹õ§ó·s
  4. fd = ThisWorkbook.Path & "\" 'ÀɮשҦb¥Ø¿ý
  5. For Each a In [A1:A5]
  6. fs = fd & a & ".xls"
  7. fb = Dir(fs)
  8. If fb <> "" Then
  9. a.Offset(, 1) = "OK"
  10. With Workbooks.Open(fd & fb)
  11.    Set sh = .Sheets(1)
  12.    ReDim Preserve sht(s) '°O¦í©Ò¦³¤u§@ªí¦WºÙ
  13.    sht(s) = sh.Name
  14.    s = s + 1
  15.    sh.Copy after:=ThisWorkbook.Sheets(1) '½Æ»s¤u§@ªí
  16.    .Close 0 'Ãö³¬ÀÉ®×
  17. End With
  18. End If
  19. Next
  20. Sheets(sht).Move '²¾°Ê©Ò¦³½Æ»sªº¤u§@ªí¨ì·sÀÉ®×
  21. Application.ScreenUpdating = True '«ì´_¿Ã¹õ§ó·s
  22. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

­ì¨Ó¬O­n³o¼Ë¤~¯à±NÀɮר֦b¤@°_§r
konantw

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C
ªð¦^¦Cªí ¤W¤@¥DÃD