- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 3# luke - Option Explicit
- Sub Ex()
- Dim S As Object, F As Object, AR, I As Integer
- Application.ScreenUpdating = False
- 'ScreenUpdating
- '¦pªG¿Ã¹õ§ó·s¥\¯à¬O¶}±Òªº«h¬° True¡CŪ/¼g Boolean¡C
- 'Ãö³¬¿Ã¹õ§ó·s¥i¥[§Ö¥¨¶°ªº°õ¦æ³t«×¡C³o¼Ë±N¬Ý¤£¨ì¥¨¶°ªº°õ¦æµ{§Ç¡A¦ý¥¨¶°ªº°õ¦æ³t«×¥[§Ö¤F¡C
- '½Ðª`·N¡A·í¥¨¶°µ²§ô®É¡A³]©wªºScreenUpdating ÄÝ©Ê·|¶Ç¦^ True¡C
- With CreateObject("Scripting.FileSystemObject").GETFolder(ThisWorkbook.Path)
- 'FileSystemObject ª«¥ó ´yz ´£¨Ñ¹ï¹q¸£Àɮרt²Îªº¦s¨ú¡C
- I = 2 '²Ä¤G¦C¶}©l
- For Each S In .SubFolders
- 'SubFolders ÄÝ©Ê ´yz ¶Ç¦^¥]§t©Ò¦³¸ê®Æ§¨ªº¤@Ó Folders ¶°¦Xª«¥ó¡A³o¨Ç¸ê®Æ§¨¥]§t¦b¬YÓ¯S©wªº¸ê®Æ§¨¤¤¡A¥]¬A³]©w¤FÁôÂéM¨t²ÎÀÉÄݩʪº¨º¨Ç¸ê®Æ§¨¡C
- For Each F In S.Files
- 'Files ¶°¦Xª«¥ó ´yz ¦b¤@Ó¸ê®Æ§¨¤ºªº©Ò¦³ File ª«¥óªº¶°¦Xª«¥ó¡C
- If UCase(F) Like "*.CSV" Then 'ÀɦW(¤j¼g)¦³ "*.CSV"
- 'Like ¹Bºâ¤l ¥Î¨Ó¤ñ¸û¨âÓ¦r¦ê
- With Workbooks.Open(F)
- AR = .Sheets(1).[A1:A3]
- .Close 0 'ÀÉ®×Ãö³¬ ¤£¦sÀÉ
- End With
- '***Cells ¨S«ü©w¤u§@ªí->§@¥Î¤¤ªº¤u§@ªí
- Cells(I, "A") = S.Name '¸ê®Æ§¨¦WºÙ
- Cells(I, "G").Resize(1, 3) = Application.WorksheetFunction.Transpose(AR)
- 'TRANSPOSE »yªk TRANSPOSE(array)
- 'Array ¬O¤u§@ªí©Î¥¨¶°ªí¤¤±z©ÒnÂà¸mªº¯x°}¡C°}¦CªºÂà¸m¬O¥H °}¦Cªº²Ä¤@¦C§@¬°·s°}¦Cªº²Ä¤@Äæ¡A¦Ó°}¦Cªº²Ä 2 ¦C«h¬°·s°}¦Cªº²Ä 2 Äæ¡A¨Ì¦¹Ãþ±À¡C
- I = I + 1 '²Ä¤G¦C¶}©l ©¹¤U¥[¤@¦C
- End If
- Next
- Next
- With Range("G:I") '***Range ¨S«ü©w¤u§@ªí->§@¥Î¤¤ªº¤u§@ªí
- .Cells.Replace ";", "", LookAt:=xlPart 'Replace:´À´«¦r¦ê
- .EntireColumn.AutoFit
- End With
- End With
- Application.ScreenUpdating = True
- '·í¥¨¶°µ²§ô®É¡A³]©wªºScreenUpdating ÄÝ©Ê·|¶Ç¦^ True¡C
- End Sub
½Æ»s¥N½X |
|