- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 16
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-14
|
¥»©«³Ì«á¥Ñ luhpro ©ó 2011-8-1 23:01 ½s¿è
¦^´_ 1# eternal001 - Private Sub cbLoad_Click()
- Dim lRow As Long, lCount As Long
- Dim sPath$, sFName$, sName$, sTheName$
- Dim bTranFile As Boolean
- Dim vSou
-
- sPath = ThisWorkbook.Path ' «ü©w¸ô®|¬°¥»ÀɮשҦbªºªº¥Ø¿ý
- bTranFile = False ' ¬ö¿ý¬O§_¦³Åª¨ìÀÉ®×
- With Me ' ¥» Sheet §Y Sheet1
- .Cells.Clear ' ²M¸ê®Æ
- .Cells(1, 1) = "±Æ¦W" ' ¼ÐÃD
- .Cells(1, 2) = "¤H¦W"
- .Cells(1, 3) = "Á`¤À"
- lRow = 2 ' ±q²Ä¤G¦C¶}©l©ñ¸ê®Æ
- lCount = 0 ' Ū¨ú¸ê®ÆÀɮ׼ƶq
- sTheName = Me.Parent.Name ' ¥»Àɮתº¥Ø¿ý
- sFName = Dir(sPath & "\*.xls") ' §ä´M²Ä¤@ÓExcelÀÉ®×
- Do While sFName <> "" ' °õ¦æ°j°é¡C
- If sFName <> sTheName Then ' ¸õ¹L¥»ÀÉ®×
- bTranFile = True
- sName = Left(sFName, Len(sFName) - 4) ' ºI¨ú¤H¦W
- sFName = sPath & "\" & sFName ' ÀÉ®×¥þ¦W
- Workbooks.Open Filename:=sFName, ReadOnly:=True ' ¶}ÀÉ
- Set vSou = ActiveWorkbook.Sheets(1) '³]©w Sheet(1) ª«¥óµ¹ vSou
- Workbooks(sTheName).Activate ' µJÂI¤Á¦^ìSheet
- .Cells(lRow, 1) = lRow - 1 ' ±Æ¦W
- .Cells(lRow, 2) = sName '¤H¦W
- .Cells(lRow, 3) = Round(vSou.Cells(vSou.Cells(1, 1). _
- CurrentRegion.Find("Á`¥§¡").Row, 2)) 'Á`¤À
- lRow = lRow + 1 ' ¦C¸¹ + 1
- lCount = lCount + 1 ' Ū¨úÀÉ®×¼Æ + 1
- End If
- If sFName <> sTheName Then Workbooks(sName & ".xls").Close ' Ãö³¬¥»ÀÉ®×¥H¥~¶}±ÒªºÀÉ®×
- sFName = Dir ' ´M§ä¤U¤@ÓÀÉ®×
- Loop
- .Range(.Cells(2, 2), .Cells(lRow, 3)).Sort Key1:=.Cells(1, 3), order1:=xlDescending ' ¥HÁ`¤À¬°ÁäÈ°µ±Æ§Ç
- End With
-
- If Not bTranFile Then
- MsgBox ("§ä¤£¨ì¥ô¦ó¸ê®ÆÀÉ®×...")
- Exit Sub
- Else
- MsgBox ("¸ê®ÆŪ¨ú§¹¦¨, ¦@Ū¨ú " & lCount & " ÓÀÉ®×...")
- Exit Sub
- End If
- End Sub
½Æ»s¥N½X
±Æ§Ç-A.zip (13.08 KB)
|
|