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

[µo°Ý] ¤ñ¹ï«á¦A·h²¾¸ê®Æ

[µo°Ý] ¤ñ¹ï«á¦A·h²¾¸ê®Æ

§Ú¥u­n§â¸ê®Æ·h²¾¨ìBÀɪºÄæ¦ì¡A¦Ó¤£¬O­n·h²¾·sªºÀɮסA¦³½Ö¥i¥H±Ð§Ú­×§ï¡H

Sub TEST()
  Dim ar, r As Long, i As Long
  Dim cIndexOld, cIndexNew, arNewHeader
  Dim f
  
  cIndexOld = Array(4, 5) 'AÀɮפ¤­n·h°ÊªºÄæ
  cIndexNew = Array(4, 5)  '·h¨ìBÀɦì¸m(Ä渹)
  arNewHeader = Array("·s¤áÄy¦a§}", "·s³q°T¦a§}") 'BÀɼÐÃD¦WºÙ
  
  f = Application.GetOpenFilename(FileFilter:="Excel ¬¡­¶Ã¯ (*.xls),*.xls", Title:="¿ï¾Ü¨Ó·½ÀÉ®×")
  If Not TypeName(f) = "String" Then Exit Sub '¨ú®ø«hµ²§ô
  
  Application.ScreenUpdating = False
  With Workbooks.Open(f)
    With .Sheets(1)
      ar = .Range("A2:E" & .[A2].CurrentRegion.Rows.Count).Value
    End With
    .Close False
  End With
  Application.ScreenUpdating = True
  
  r = UBound(ar)
  With Workbooks.Add
    With .Sheets(1)
      For i = LBound(cIndexOld) To UBound(cIndexOld)
        .Cells(1, cIndexNew(i)).Resize(r).Value = Application.WorksheetFunction.Index(ar, 0, cIndexOld(i))
        .Cells(1, cIndexNew(i)).Value = arNewHeader(i)
      Next

    End With
  End With
  

   
End Sub

¦^´_ 1# game78214
§A»¡:§Ú¥u­n§â¸ê®Æ·h²¾¨ìBÀɪºÄæ¦ì
¨º´N¶}±ÒBÀɵM«á©ñ¤W¸ê®Æ°Ú.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


    ¬O­n¤ñ¹ïA¡BBÀɮתºA¡BBÄæ¦ì«á¡A¤ñ¹ï¨ì¤@¼Ëªº¡A¦b·h²¾AÀɮתºD¡BEÄæ¦ì¸ê®Æ¨ìBÀɮתºD¡BEÄæ¦ì¸Ì¡C
   ¤p§Ìªº¤åªk«ÜÄê¡Aªí¹F¤£²M¡ASORRY¡I
¤áÄy½d¨Ò.rar (4.29 KB)

TOP

¦^´_ 3# game78214
  1. Dictionary ª«¥ó
  2. ª«¥ó , ¥Î©óÀx¦s¸ê®ÆÃöÁä¦r©M¶µ¥Ø¹ï
½Æ»s¥N½X
  1. Option Explicit
  2. Sub Ex()
  3.     Dim D As Object, I As Integer
  4.     Set D = CreateObject("SCRIPTING.DICTIONARY")
  5.     With Workbooks("A.xls").Sheets(1)
  6.         I = 2
  7.         Do While .Cells(I, "A") <> ""
  8.           D(.Cells(I, "A") & .Cells(I, "B")) = Array(.Cells(I, "C"), .Cells(I, "D"))
  9.           I = I + 1
  10.         Loop
  11.     End With
  12.     With Workbooks("B.xls").Sheets(1)
  13.         I = 2
  14.         Do While .Cells(I, "A") <> ""
  15.           If D.EXISTS(.Cells(I, "A") & .Cells(I, "B")) Then .Cells(I, "C").Resize(, 2) = D(.Cells(I, "A") & .Cells(I, "B"))
  16.           I = I + 1
  17.         Loop
  18.     End With
  19. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE


    ¨º­Ó§Ú­n¹ï¤ñªº¸ê®Æ¦³¤­¸U¦hµ§¡A©Ò¥H¨S¿ìªk°õ¦æ­C.....

TOP

¦^´_ 5# game78214
¬O¨ººØµLªk°õ¦æ(¤ÓºC¤F)
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 6# GBKEE


   ¨S¦³¤ÏÀ³

TOP

¦^´_ 7# game78214
¦³´ú¸Õ§A 3#¤W©Ò¤W¶ÇªºÀɮ׶Ü?
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¨ü¤HÂI¤ô¤§®¦¡A¶··í´é¬u¥H³ø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD