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

¼gVBA¨Ì§Ç¶}±ÒÃþ¦üªºexcelÀÉ

¼gVBA¨Ì§Ç¶}±ÒÃþ¦üªºexcelÀÉ

§Ú·Q¼g¤@­ÓVBA¨Ì§Ç¶}±ÒÀɦW¬°ABC1.xls,  ABC2.xls,  ABC3.xls....ªºexcelÀÉ
§Ú¸Õ¹L¥Îopen¥~¥[°j°é¦ý¤£¦æ,¦³errorµo¥Í
·Q½ÐªO¤W¦U¦ì¤j¤jÀ°¦£,·P¿E¤£ºÉ

¥t¥~,§Ú·Q¦b¦³VBAªºexcelÀɬY¤T­ÓÀx¦s®æ¼g113,115,18³o¤T­Ó¼Æ¦r,µM«á³o¤T­Ó¼Æ¦r·|¹ïÀ³¨ì¥´¶}ªºexcelÀÉ,¦pABC1.xls
µM«á¶i¦æ·j´M,·í§ä¨ì³o¤T­Ó¼Æ¦r«á,¦b¥¦­Ì©Ò¦bªºcolumn¶i¦æ¿z¿ï³Ì¤j­È,¤]·Q½Ð°Ýª©¤W¤j¤j¦³¤°»ò¦n·N¨£¶Ü?
ÁÂÁÂ!!!
wsiad

¦^´_ 7# Hsieh

¬O§Ú·Q¿ù¤F,§Ú¥H¬°with end with ÁÙ¦³¨ä¥L¥Îªk,¦]¬°¤£¼ôªºÃö«Y
¤µ¤Ñ¦A¬ã¨sµo²{¥¦´N¥u¬O¬Ù²¤ª«¥ó¦WºÙ¤è«K,´N¹³.Close¤@¼Ë
sorry

¥t¥~,§ÚÁÙ·Q½ÐHsieh¤j§A¦AÀ°§Ú¼g¨â­Ó§PÂ_¦¡¦n¶Ü?¦b§Úmodule1¸Ì­±§Ú¦³µù¸Ñ
¦A³Â·Ð§A¤F,§Úªº¥¨¶°´N³Ñ³o¨â­Ó¦a¤è¦b°µ¤@¤U¨¾§b´N¸Ñ¨M¤F
·PÁÂ!!!
Wisad.rar (54.98 KB)
wsiad

TOP

¦^´_ 6# wisad
With....End With
°£¤F¤£¥²­«½Æ¨Ï¥Îª«¥ó±Ô­z¥~¡A±zÁ٬ݨì¬Æ»ò¤£¦P¥Îªk?
¤p§Ì¨£ÃѲLÁ¡¡AÁٽХS¥x«ü¾É
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 5# Hsieh
Hsieh¤j ÁÂÁÂ!

·Q½Ð°Ý¬°¤°»ò13¦æªº".Close"­Y§ï¦¨"Close",ÁöµMÁÙ¬O¥i¥H¨ú­È¦ý­ì©lÀÉ«o¨S¿ìªkÃö±¼©O?
Close¤£´N¬OÃö±¼©Ò¦³¶}±Òªº¬¡­¶Ã¯,¦b³o¸Ì¬O§â­ì©lÀÉÃö±¼?!

¥t¥~,¥i¥H¦A½Ð±ÐWith....End withªº¥Îªk¶Ü?
§Ú¤@ª½¤£¬O«Ü²M·¡¥¦ªº¥\¥Î©Î¥Îªk,¥uª¾¹D¦bWith...End with°Ï¶ô¤ºªºÄݩʤ£¥Î¦A¥´¤@¦¸ª«¥ó¦WºÙ
¦ý¬Ý½d¨Ò©Î¬O¨ä¥L¤Hªº¦n¹³ÁÙ¦³¨ä¥L¥Î³~

¤Q¤À·PÁÂ!!!
wsiad

TOP

¦^´_ 4# wisad
  1. Sub Eddie_OTP2()
  2.     Application.ScreenUpdating = False
  3.     fd = ThisWorkbook.Path & "\" '"C:\OTP\"'¥H¬Û¦P¥Ø¿ý´ú¸Õ
  4.     obs = Array("OTP1.xls", "OTP2.xls") 'ÀɮצCªí   
  5.     r = 6 '¼g¤J°_©l¦C¦ì
  6.         For i = 0 To 1
  7.         With Workbooks.Open(fd & obs(i)) '¶}±ÒÀÉ®×
  8.            For j = 13 To 15
  9.               fstr = "CH" & ThisWorkbook.ActiveSheet.Cells(3, j)
  10.                  Set a = .Sheets(1).Rows("7:7").Find(fstr, lookat:=xlWhole) '·j´M
  11.                  If Not a Is Nothing Then ThisWorkbook.ActiveSheet.Cells(r, j) = Application.Max(a.EntireColumn)
  12.            Next
  13.         .Close
  14.         r = r + 1
  15.         End With
  16.         Next
  17. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

Hsieh¤j
¨ä¹ê¥u­nGetData.xlsªºCell(3,13)Àx¦s®æ¤º®e¯à°÷³Q1.xlsªºRows("7:7")Äæ·j´M¨ì,§Úªº°ÝÃD´N¸Ñ¨M¤@¥b¤F,§Ú´N¤ñ¸û¦³§â´¤³Ñ¤Uªº¥i¥H¦Û¤v¨Ó,·PÁ§AªºÀ°¦£³á!!!
wsiad

TOP

¦^´_ 2# Hsieh

­º¥ýÁÂÁÂHsieh¤jªºÀ°¦£, ¦^µª¤@¥i¥H¥Î Wisad.rar (284.22 KB)
¦Ü©ó°ÝÃD¤G,³Â·Ð½Ð¬ÝÀ£ÁYÀɤºGetData.xls module-housing¸Ìªºµù¸Ñ´y­z,ÁÂÁÂ
wsiad

TOP

¦^´_ 1# wisad


    ´`§Ç¶}ÀɸոÕ
  1. Sub nn()
  2. fd = "D:\" 'Àɮץؿý
  3. obs = Array("ABC1.xls", "ABC2.xls", "ABC3.xls")
  4. For Each ob In obs
  5.    Workbooks.Open fd & ob
  6. Next
  7. End Sub
½Æ»s¥N½X
²Ä¤G­Ó°ÝÃD¬Ý¤£À´´y­z
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¨S¦³©Ò¦³Åv¡A¥u¦³¥Í©Rªº¨Ï¥ÎÅv¡C
ªð¦^¦Cªí ¤W¤@¥DÃD