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

[µo°Ý] ±Æ§Ç«á§R°£¯S©wÄd¦ì

¦^´_ 1# billchenfantasy
¨Ì§A±Ô­zªº»Ý¨DÀ³¸Ó¥Î¤@¯ëExcel¾Þ§@´N¥i¹F¦¨:
¥ý±N¤£¥²­nªºÄæ§R°£ , ¦A¨ì  ¸ê®Æ>±Æ§Ç(excel 2010)  ³]©w§Y¥i

TOP

¦^´_ 3# billchenfantasy
>> Private Sub CommandButton1_Click()
>> ¥H¤W¬O±N¸ê®Æ¶×¤J¨Ã¶}·sªº¤u§@ªí(¦P®É¦WºÙ¬°¸Ó¸ê®ÆÀÉ)½Ð°Ý­n¦p¦ó³]¸m¦Û°Ê©R¦W¬°¦P¤@­Ó¤u§@ªí¦WºÙ?

¤£©ú¥Õ§Aªº·N«ä , §A½Æ»s¤u§@ªí¹L¨Ó®É¦W¦rÀ³¸Ó¬O©M­ì¥»¤u§@ªí¤@¼Ëªº

>>Private Sub CommandButton2_Click()

¸Õ¸Õ¬Ý
Private Sub CommandButton2_Click()
With Sheets("¤u§@ªí¦WºÙ")
    .[A1].CurrentRegion.Sort Key1:=.[E:E], Order1:=xlAscending, _
                             Key2:=.[F:F], Order2:=xlAscending, _
                             Header:=xlYes
    .Range("A:C,E:I,K:L,Q:Q").Delete Shift:=xlToLeft
End With
End Sub

TOP

¦^´_ 5# billchenfantasy
¦P¤@¬¡­¶Ã¯¬O¤£¯à¦³¦h­Ó¬Û¦P¦WºÙªº¤u§@ªí

§A­nªº§å¦¸³B²z¬O³o¼Ë¶Ü? (¥i¿ï¦h­ÓÀÉ®×)
  1. Private Sub CommandButton1_Click()
  2. Dim Source, f

  3. '¥i¿ï¾Ü¦h­ÓÀÉ®×
  4. Source = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls; *.xlsx),*.xls;*.xlsx", _
  5.                                     MultiSelect:=True)
  6. If TypeName(Source) = "Boolean" Then If Source = False Then Exit Sub

  7. For Each f In Source
  8. '¶}±ÒÀÉ®×/¬¡­¶Ã¯
  9. With Workbooks.Open(f)
  10.     '¹ï©Ò¦³¤u§@ªí
  11.     For i = 1 To ActiveWorkbook.Sheets.Count
  12.         '½Æ»s¤u§@ªí¨ì¥»¬¡­¶Ã¯
  13.         .Sheets(i).Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
  14.         '¥»¬¡­¶Ã¯¤¤¸Ó¤u§@ªí
  15.         With ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
  16.            '¨ÌE,FÄæ±Æ§Ç
  17.            .[A1].CurrentRegion.Sort Key1:=.[E:E], Order1:=xlAscending, _
  18.                                     Key2:=.[F:F], Order2:=xlAscending, _
  19.                                     Header:=xlYes
  20.            '§R°£¤£­nªºÄæ
  21.            .Range("A:C,E:I,K:L,Q:Q").Delete Shift:=xlToLeft
  22.         End With
  23.     Next i
  24.     'Ãö³¬ÀÉ®×
  25.     .Close
  26. End With
  27. Next f
  28. End Sub
½Æ»s¥N½X

TOP

¦^´_ 7# billchenfantasy
  1. Private Sub CommandButton1_Click()
  2. Dim Source, f
  3. Dim rng As Range

  4. '¥i¿ï¾Ü¦h­ÓÀÉ®×
  5. Source = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls; *.xlsx),*.xls;*.xlsx", _
  6.                                     MultiSelect:=True)
  7. If TypeName(Source) = "Boolean" Then If Source = False Then Exit Sub

  8. For Each f In Source
  9. '¶}±ÒÀÉ®×/¬¡­¶Ã¯
  10. With Workbooks.Open(f)
  11.     '¹ï©Ò¦³¤u§@ªí
  12.     For i = 1 To ActiveWorkbook.Sheets.Count
  13.         '½Æ»s¤u§@ªí¨ì¥»¬¡­¶Ã¯
  14.         .Sheets(i).Copy after:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
  15.         '¥»¬¡­¶Ã¯¤¤¸Ó¤u§@ªí
  16.         With ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
  17.            '¨Ìland_no_m, land_no_cÄæ±Æ§Ç
  18.             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
  19.             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
  20.             
  21.             '§ä¥X¤£²Å¦XªºÄæ
  22.             For j = 1 To .[A1].CurrentRegion.Columns.Count
  23.                 If IsError(Application.Match(.Cells(1, j).Value, Array("section", "SC", "LANDUSE", "PUBNO", "OPTION", "METHOD", "MUPLAN", "DUPLAN", "ORG_FID"), 0)) Then
  24.                     If rng Is Nothing Then Set rng = .Columns(j) Else Set rng = Union(rng, .Columns(j))
  25.                 End If
  26.             Next j
  27.             '§R°£
  28.             .Range(rng.Address).Delete shift:=xlToLeft
  29.             Set rng = Nothing
  30.         End With
  31.     Next i
  32.     'Ãö³¬ÀÉ®×
  33.     .Close
  34. End With
  35. Next f
  36. End Sub
½Æ»s¥N½X

TOP

¦^´_ 10# billchenfantasy
land_no_m, land_no_c ¨C±iªí³£¦³¶Ü?
  1.     If Not (IsError(Application.Match("land_no_m", .Rows(1), 0)) Or _
  2.             IsError(Application.Match("land_no_c", .Rows(1), 0))) Then
  3.         .[A1].CurrentRegion.Sort Key1:=.Columns(Application.Match("land_no_m", .Rows(1), 0)), _
  4.                                     Order1:=xlAscending, _
  5.                                     Key2:=.Columns(Application.Match("land_no_c", .Rows(1), 0)), _
  6.                                     Order2:=xlAscending, _
  7.                                     Header:=xlYes
  8.     Else
  9.         MsgBox .Sheets(i).Name & " : Sorting field not found."
  10.     End If
½Æ»s¥N½X

TOP

¦^´_ 12# billchenfantasy
®¦ ¸Õ¤F¤@¤U  #10 ªº¨â¦æ¶¶§Ç½Õ´«
µ²ªGÀ³¸Ó¸ò #11 ¤@¼Ë

TOP

        ÀR«ä¦Û¦b : ¥¬¬I¦p¼½ºØ¡A¥HÅw³ß¤ß´þ¼íºØ¤l¡A¤~·|µoªÞ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD