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

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

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

¥»©«³Ì«á¥Ñ yanto913 ©ó 2012-4-14 10:30 ½s¿è

½Ð¨£ªþÀÉ
±NÀɮשñ¨ìC:\¼Ñ

¦¹¸ê®Æ§¨¤º¦³¤­­ÓEXCEL¤À§O¬O1.xls~5.xls
°õ¦æall.xls¶×¤J1.xls~5.xls
²{ªp¬O¨S°ÝÃD

¦ý¬O§Ú·Q½Ð±Ðªº¬O¦pªG¤¤¶¡¦³¯ÊÀÉ·|²£¥Í¿ù»~(°²³]¯Ê1.xls, 3.xls, 4.xls)
¬d¾\ºô¯¸¦³»¡­n¥Îon error goto
¦ý¬O¿ù»~¦n¹³¥u¯à¸õ¹L¤@¦¸¡A²Ä¤G¦¸ÁÙ¬O·|¥X²{¿ù»~

¥t¥~Âà¥X®É¤]·|¥X²{°ÝÃD
¦]¬°§Ú¤£·|§PÂ_°}¦C¬°±q²Ä¤G­Ósheet(2)~³Ì«á¤@­Ó¶×¥X

Àµ½Ð¦U¦ì¥ý¶i½ç±Ð   ÁÂÁÂ

°ÝÃDÁ|¨Ò1.rar (17.86 KB)

YOYO

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

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

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

¦^´_ 10# LeafYeung

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

TOP

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

¦^´_ 9# Hsieh

Hsieh ª©¥D
½Ð°Ý¥H¤Uµ{§Ç¦b°õ¦æ²Ä¤G¦¸ on error goto ®É ¬°¦ó·|¥X²{ error ©O??

Sub test1()
For i = 1 To 10
On Error GoTo AAA '¿ù»~®É¸õ¦Ü
B = i / 0 '»s³y¿ù»~
AAA:
On Error GoTo 0
Next
End Sub

·í i=1®É´N¥i¦æ,¦ý·íi=2®É´N error
·Ð½Ð±Ð¾É~~ÁÂÁÂ

TOP

¦^´_ 8# yanto913


    ¬Ý§AA1:A5ªºÀɦW¼Ë¦¡¬°¦ó?¬O§_¥]§t¸ê®Æ§¨¥Ø¿ý©Î°ÆÀɦW
¤£¦P¸ê®Æ¦³¤£¦P³B²z¤è¦¡¡A¥H¼Ó¤Wªºµ{¦¡½X¥h¥[§PÂ_¦¡À³¸Ó¤£¬O«ÜÃøªº
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 7# Hsieh




    ÁÂÁÂHsieh ª©¥D

½Ð°Ý¦pªG§Ú¥u·Q­n§âsheets("all")¤¤A1~A5¬°ÀɦW¥h·j´Mxls
¦Ó¥B·j´M¨ìªº¦bsheets("all")¤¤B1~B5¼Ð¥Ü"OK"¸Ó¦p¦ó°µ©O?
YOYO

TOP

¦^´_ 1# yanto913
  1. Sub test()
  2. Dim sht()
  3. Application.ScreenUpdating = False 'Ãö³¬¿Ã¹õ§ó·s
  4. fd = ThisWorkbook.Path & "\" 'ÀɮשҦb¥Ø¿ý
  5. fs = fd & "*.xls"
  6. fb = Dir(fs)
  7. Do Until fb = "" '©Ò¦³xlsÀÉ®×°j°é
  8. If fb <> ThisWorkbook.Name Then
  9. With Workbooks.Open(fd & fb)
  10.    Set sh = .Sheets(1)
  11.    ReDim Preserve sht(s) '°O¦í©Ò¦³¤u§@ªí¦WºÙ
  12.    sht(s) = sh.Name
  13.    s = s + 1
  14.    sh.Copy after:=ThisWorkbook.Sheets(1) '½Æ»s¤u§@ªí
  15.    .Close 0 'Ãö³¬ÀÉ®×
  16. End With
  17. End If
  18. fb = Dir
  19. Loop
  20. Sheets(sht).Move '²¾°Ê©Ò¦³½Æ»sªº¤u§@ªí¨ì·sÀÉ®×
  21. Application.ScreenUpdating = True '«ì´_¿Ã¹õ§ó·s
  22. End Su
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : µêªÅ¦³ºÉ¡D§ÚÄ@µL½a¡AµoÄ@®e©ö¦æÄ@Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD