- ©«¤l
- 913
- ¥DÃD
- 150
- ºëµØ
- 0
- ¿n¤À
- 1089
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- office 2019
- ¾\ŪÅv
- 50
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2011-8-28
- ³Ì«áµn¿ý
- 2023-7-19
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2017-7-29 18:15 ½s¿è
¦^´_ 2# GBKEE
¤j¤j,
½Ð«ü¾É¤@¤U,§Ú¬On¨Ó·½Àɦb¥¼½Æ»s¸ê®Æ¤§«e¥ý±Æ§Ç,¦ýÁ`¬O¦³¨Ç°ÝÃD
1) ¨Ó·½ÀÉ»P¥ØªºÀɦP®É¨Æ¥ý¶}±Ò,©Î¦P®É¤£n¶}±Ò,¥¦³£µLªk°õ¦æ
2) ¥ý¶}±Ò¥ØªºÀÉ,¦A°õ¦æ¥¨¶°³o®É¥¦·|¦Û¦æ¥´¶}¨Ó·½ÀÉ,³o¼Ë´N¥i¥H§¹¥þ°õ¦æ¤]·|¥ý±Æ§Ç¦A¶K¤W.
3) §Ún«ç»òקïÅý¥¦§¹¥þ¥¿±`¡H- Option Explicit
- Dim ¥ØªºÀÉ As Workbook, ¨Ó·½ÀÉ As Workbook
- Sub ®w¦s§ó·s()
- Dim xRng As Range
- File_settings ¨Ó·½ÀÉ, "®w¦s¸ê®Æªí.xlsx"
- File_settings ¥ØªºÀÉ, "ERP_Data.xlsx"
- Set xRng = ¨Ó·½ÀÉ.Sheets(1).UsedRange 'UsedRange->¤u§@ªí©Ò¨Ï¥Îªº½d³ò,¦pA:AA¤§«á¦A¤]¨S¸ê®Æ
-
- '¨Ó·½ÀɲĤ@Ó¤u§@ªí,±Æ§Ç 1) L 2)F
- With ¨Ó·½ÀÉ.Sheets(1).Range("A:AA")
- .Cells.Sort Key1:=.Columns("L"), Key2:=.Columns("F"), _
- Header:=xlYes
- xRng.Copy 'A:AA½Æ»s¨ì¥ØªºÀÉB:AB
- With ¥ØªºÀÉ.Sheets("®w¦s")
- .Range("B1").PasteSpecial xlPasteValues '¿ï¾Ü©Ê¶K¤WÈ
-
- '¦Û°Ê²M°£¥ØªºÀÉ1065:1073¦C
- .Range("a" & xRng.Rows.Count + 1, .Range("A1101")).Resize(, 37).Clear
- End With
- End With
- ¨Ó·½ÀÉ.Close False '¨Ó·½ÀÉÃö³¬ÀÉ®×(¤£·|°Ý¬O§_¦sÀÉ)
- ¥ØªºÀÉ.Save
-
- End Sub
- Sub File_settings(xFile As Workbook, ¤u§@¶ As String) 'Àɮ׳]©w
- Dim xPath As String
- xPath = ThisWorkbook.Path & "\"
- If UCase(¤u§@¶) <> UCase("ERP_Data.XLSX") Then xPath = xPath & "FromERP\"
- On Error Resume Next
- Set xFile = Workbooks(¤u§@¶)
- If Err > 0 Then Set xFile = Workbooks.Open(xPath & ¤u§@¶)
- If xFile.Name = "" Then
- MsgBox "½Ð¬d¬Ý " & vbLf & xPath & vbLf & "¬O§_¦³ [" & ¤u§@¶ & "]"
- End
- End If
- End Sub
½Æ»s¥N½X |
|