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

[µo°Ý] VBA¦³¿ìªkÅã¥Ü"­þ¤@¦æ"¿ù»~¨Ã¥[¥H°O¿ý¶Ü?

[µo°Ý] VBA¦³¿ìªkÅã¥Ü"­þ¤@¦æ"¿ù»~¨Ã¥[¥H°O¿ý¶Ü?

°²³]A¤£À´VBA,B¬°¼¶¼gªÌ
¦ýA¾Þ§@¦¹¥¨¶°¦³°ÝÃD
  1. Sub test()
  2.     Workbooks.Open ("C:\ªí1.xlsm")
  3.     Workbooks.Open ("C:\ªí2.xlsm")
  4.     Workbooks.Open ("C:\ªí3.xlsm")
  5.     Workbooks.Open ("C:\ªí4.xlsm")
  6. End Sub
½Æ»s¥N½X
¦³¿ìªk·Ç½Tªº±oª¾­þ¤@¦æ¿ù»~¶Ü?
´N¥i¥H¥[¥H¬ö¿ý¦b¬Ysheet¤º,«Ýµ{¦¡¼¶¼gªÌ³B²z?
ex:sheets("Sheet1").range("a1").value= "¿ù»~ªº¨º¦æµ{¦¡½X"  or ¿ù»~ªºµ{¦¡½X¬°²Ä´X¦æ

©Î¬O¥i³z¹L¦óºØ¤èªk¹F¦¨¬Û¦P®ÄªG,(A¾Þ§@¦³°ÝÃD,B¤£¥²­«·s¾Þ§@§Y¥i³z¹Lµ{¦¡±oª¾µo¥Íªº°ÝÃD)
PKKO

¥»©«³Ì«á¥Ñ luhpro ©ó 2014-11-22 00:45 ½s¿è
°²³]A¤£À´VBA,B¬°¼¶¼gªÌ
¦ýA¾Þ§@¦¹¥¨¶°¦³°ÝÃD¦³¿ìªk·Ç½Tªº±oª¾­þ¤@¦æ¿ù»~¶Ü?
´N¥i¥H¥[¥H¬ö¿ý¦b¬Ysheet¤º, ...
PKKO µoªí©ó 2014-11-22 00:04
  1. Sub test()
  2.   Dim iI%
  3.   Dim sFlNm()
  4.   
  5.   On Error GoTo ErrHand
  6.   sFlNm = Array("C:\ªí1.xlsm", "C:\ªí2.xlsm", "C:\ªí3.xlsm", "C:\ªí4.xlsm")
  7.   For iI = 0 To UBound(sFlNm)
  8.     Workbooks.Open sFlNm(iI)
  9.   Next
  10. Exit Sub

  11. ErrHand:
  12.   sheets("Sheet1").range("a1")= sFlNm(iI)
  13.   Resume Next
  14. End Sub
½Æ»s¥N½X
  1. Sub test()
  2.   Dim iI%
  3.   Dim sFlNm()
  4.   
  5.   On Error GoTo ErrHand
  6.   
  7.   sFlNm = "C:\ªí1.xlsm"
  8.   Workbooks.Open sFlNm
  9.   
  10.   sFlNm = "C:\ªí2.xlsm"
  11.   Workbooks.Open sFlNm
  12.   
  13.   sFlNm = "C:\ªí3.xlsm"
  14.   Workbooks.Open sFlNm
  15.   
  16.   sFlNm = "C:\ªí4.xlsm"
  17.   Workbooks.Open sFlNm
  18. Exit Sub

  19. ErrHand:
  20.    sheets("Sheet1").range("a1")= sFlNm
  21.   Resume Next
  22. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# luhpro


    luhpro ¤j±z¦n,·PÁ±zªº¦^ÂÐ,¥i¯à¬O§Ú¥DÃDªº³¡¤Àªí¹Fªº¤£²M·¡
­Yµ{¦¡¦³¤T¦Ê¦æ,©Î¬O¤¬¬Û©I¥sN­Ó¥¨¶°,¤£¤Ó¥i¯à¥Î¤W­zªº¤è¦¡¼¶¼g
¦³¨ä¥L¤è¦¡¥i¹F¦¨¬Û¦P®ÄªG¶Ü?

ÁÙ¬O»¡~µ{¦¡¼¶¼g,¥»¨Ó´N­n¹³¤j¤j¤@¼Ë¨C¦æ³£³]©w°»¿ù,¤~¦³¿ìªkª¾¹D­þÃä¿ù»~~?
PKKO

TOP

¦^´_ 3# PKKO
µ{¦¡¼¶¼g,¥»¨Ó´N­n¹³¤j¤j¤@¼Ë¨C¦æ³£³]©w°»¿ù,¤~¦³¿ìªkª¾¹D­þÃä¿ù»~~?  <===

¾Ú§Ú©Òª¾ Excel VBA ¥»¨­¦ü¥G¨Ã¨S¦³´£¨Ñ§ì¨ú²{¦b°õ¦æ¨ì²Ä´X¦C«ü¥O¤§Ãþªº¨ç¦¡©Î¨t²ÎÅܼÆ,
³o¥i±q¨t²Î¿ù»~°T®§¥u·|¨q¿ù»~¥N½X»P¿ù»~­ì¦]¨Ó±oª¾.

ÁöµM¦³³æ¨B°»¿ù¼Ò¦¡¥i¥H°lÂÜ,
¦ý¦³®É³æ¨B¼Ò¦¡»P¹ê»Ú°õ¦æ±¡§ÎÁÙ¬O·|¦³¸¨®t.

©Ò¥H³o³¡¤À§Úı±o¥i¯àÁÙ¬O­nµ{¦¡³]­p®v¦Û¤v©w¸q¿ë§Oªº¤è¦¡,
³Ì²³æªº¤èªk¬O¦b¨C­Ó°ÝÃD¥i¯àµo¥ÍªºÃöÁäÂI¤§«e±N§PÂ_ÅܼƤº®e³]©w¦n,
³o¼Ë¿ù»~³B²z°Ï¤~¯à´£¨Ñ¬ÛÃö°T®§(©Î¬OÅã¥Ü¬ÛÃö°T®§«á, ª½±µ¥Î Resume Next ²¤¹L¿ù»~)µ¹µ{¦¡³]­p®v.

¹ê°È¤W§Ú¬O«Øij¦h°Ñ¦Ò2#¤¤²Ä¤@ºØ¤è¦¡±Nµ{¦¡Â²¤Æ,
§Q¥Î¦UºØ¤è¦¡§â¬Û¦ü¥\¯à¾ã¦X¦b¤@°_³B²z,
¦Ó«D¯Âºé¥Î±ø¦C´`§Çªº¤è¦¡°õ¦æµ{¦¡,
³o¼Ë·|¤ñ¸û®e©ö­×§ï¤Î½Õ¾ãµ{¦¡.

TOP

¦^´_ 4# luhpro


    ·PÁ¤j¤j!
PKKO

TOP

        ÀR«ä¦Û¦b : ¡i°µ¤Hªº¶}©l¡j¨C¤@¤Ñ³£¬O¬G¤Hªº¶}©l¡A¨C¤@­Ó®É¨è³£¬O¦Û¤vªºÄµ±§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD