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

[µo°Ý] ½Ð±ÐVBA¸ô®|ÅܼƳ]©w

[µo°Ý] ½Ð±ÐVBA¸ô®|ÅܼƳ]©w

¥»©«³Ì«á¥Ñ x7776658 ©ó 2021-11-11 21:26 ½s¿è

§Ú¬OVBAªì¾ÇªÌ¡A»Ý­n½Ð±Ð¦U¦ìVBA«e½ú­Ì
«ü¥O½X¦p¤U¡A¦Ó§Ú§Æ±æ¯à°÷±N'D:\test\ i \[test.xlsx]¤u§@ªí1'ªºi¬OÅܼơA¥[¤J©ó°j°é¤§¤¤
¦ý°õ¦æµ²ªG¤£¦p¹w´Á¡A¸ô®|µLªkÅܦ¨ÅܼÆ

Sub ¥¨¶°1()

Dim i
For i = 1 To 2 Step 1
Range("a" & i & ":d" & i).Formula = "='D:\test\ i \[test.xlsx]¤u§@ªí1'!A1:D1"
Range("a" & i & ":d" & i).Formula = Range("a" & i & ":d" & i).Value

Next

End Sub

¦^´_ 1# x7776658


Sub test()
FPath = "D:\test\i\test.xlsx"
With Workbooks.Open(FPath)
    '±zªº¥Dµ{¦¡»Ý¨D¡A¦]¬°±zªº¼gªk¦³°ÝÃD
    '©Ò¥HµLªk±oª¾±z¹ê»Úªº»Ý¨D
    .Close
End With
End Sub

TOP

¦^´_ 2# samwang    

D:\test\   ¦³¨â­Ó¸ê®Æ§¨¡A¤À§O¬OD:\test\1  ¤Î  D:\test\2¡A³o¨â­Ó¸ê®Æ§¨³£¦³test.xlsx


§Ú§Æ±æ¯à§â¤£¦P¸ê®Æ§¨ªºexcel¸ê®Æ(¥s°µtest.xlsx)¾ã¦X¦Ü¤@­Óexcel ( ¥s°µtotal.xlsm)¡A¦p¤U¹Ï©Ò¥Ü


ÁÂÁÂ

TOP

¦^´_ 3# x7776658

¥i¥H´£¨Ñªþ¥ó¡A·Q­n¾ã¦X2­ÓÀɮתºµ²ªG¬°¤°»ò¼Ë¤l¡AÁÂÁÂ

TOP

¦^´_ 4# samwang
±z¦n

D:\test\1\test.xlsx


D:\test\2\test.xlsx


¾ã¦X¦Ü
D:\test\total.xlsm


ÁÂÁÂ

TOP

¦^´_ 5# x7776658

½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ

Sub test()
For i = 1 To 2
    FPath = "D:\test\" & i & "\test.xlsx"
    With Workbooks.Open(FPath)
         Arr = Range("a1:d1")
        .Close
    End With
    Range("a" & i).Resize(, 4) = Arr
Next
End Sub

TOP

¦^´_ 6# samwang

°õ¦æ¦¨¥\¡AÁÂÁ¤j¤jµL¨p¤À¨É

TOP

        ÀR«ä¦Û¦b : ±o²z­nÄǤH¡A²zª½­n®ð©M¡C
ªð¦^¦Cªí ¤W¤@¥DÃD