| ©«¤l1018 ¥DÃD15 ºëµØ0 ¿n¤À1058 ÂI¦W0  §@·~¨t²Îwin7 32bit ³nÅ骩¥»Office 2016 64-bit ¾\ŪÅv50 ©Ê§O¨k ¨Ó¦Û®ç¶é µù¥U®É¶¡2012-5-9 ³Ì«áµn¿ý2022-9-28 
 | 
                
| ¦^´_ 7# billchenfantasy ½Æ»s¥N½XPrivate Sub CommandButton1_Click()
Dim Source, f
Dim rng As Range
'¥i¿ï¾Ü¦hÓÀÉ®×
Source = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls; *.xlsx),*.xls;*.xlsx", _
                                    MultiSelect:=True)
If TypeName(Source) = "Boolean" Then If Source = False Then Exit Sub
For Each f In Source
'¶}±ÒÀÉ®×/¬¡¶Ã¯
With Workbooks.Open(f)
    '¹ï©Ò¦³¤u§@ªí
    For i = 1 To ActiveWorkbook.Sheets.Count
        '½Æ»s¤u§@ªí¨ì¥»¬¡¶Ã¯
        .Sheets(i).Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
        '¥»¬¡¶Ã¯¤¤¸Ó¤u§@ªí
        With ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
           '¨Ìland_no_m, land_no_cÄæ±Æ§Ç
            If Not IsError(Application.Match("land_no_m", .Rows(1), 0)) Then .[A1].CurrentRegion.Sort Key1:=.Columns(Application.Match("land_no_m", .Rows(1), 0)), Order1:=xlAscending, Header:=xlYes
            If Not IsError(Application.Match("land_no_c", .Rows(1), 0)) Then .[A1].CurrentRegion.Sort Key1:=.Columns(Application.Match("land_no_c", .Rows(1), 0)), Order1:=xlAscending, Header:=xlYes
            
            '§ä¥X¤£²Å¦XªºÄæ
            For j = 1 To .[A1].CurrentRegion.Columns.Count
                If IsError(Application.Match(.Cells(1, j).Value, Array("section", "SC", "LANDUSE", "PUBNO", "OPTION", "METHOD", "MUPLAN", "DUPLAN", "ORG_FID"), 0)) Then
                    If rng Is Nothing Then Set rng = .Columns(j) Else Set rng = Union(rng, .Columns(j))
                End If
            Next j
            '§R°£
            .Range(rng.Address).Delete shift:=xlToLeft
            Set rng = Nothing
        End With
    Next i
    'Ãö³¬ÀÉ®×
    .Close
End With
Next f
End Sub
 | 
 |